(ctx context.Context)
| 62 | } |
| 63 | |
| 64 | func (l *Flags) Open(ctx context.Context) (api.Interface, error) { |
| 65 | uri, err := l.ClientURI() |
| 66 | if err != nil { |
| 67 | return nil, err |
| 68 | } |
| 69 | if api.IsRemote(uri.String()) { |
| 70 | conn, err := l.Connection() |
| 71 | if err != nil { |
| 72 | return nil, err |
| 73 | } |
| 74 | return api.NewRemoteDB(conn), nil |
| 75 | } |
| 76 | DB, err := api.Connect(ctx, zap.Must(zap.NewProduction()), uri.String()) |
| 77 | if errors.Is(err, db.ErrNotExist) { |
| 78 | return nil, fmt.Errorf("%w\n(hint: run 'super db init' to initialize a database at this location)", err) |
| 79 | } |
| 80 | return DB, err |
| 81 | } |
| 82 | |
| 83 | func (l *Flags) AuthStore() *auth0.Store { |
| 84 | return auth0.NewStore(filepath.Join(l.ConfigDir, "credentials.json")) |
no test coverage detected