Skip to content

Commit

Permalink
fix: log version & migration count (#1934)
Browse files Browse the repository at this point in the history
  • Loading branch information
kangmingtay authored Feb 5, 2025
1 parent 21c2256 commit 8078cdc
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions cmd/migrate_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ func migrate(cmd *cobra.Command, args []string) {
// turn off schema dump
mig.SchemaPath = ""

err = mig.Up()
count, err := mig.UpTo(0)
if err != nil {
log.Fatalf("%v", errors.Wrap(err, "running db migrations"))
} else {
log.Infof("GoTrue migrations applied successfully")
log.WithField("count", count).Infof("GoTrue migrations applied successfully")
}

log.Debugf("after status")
Expand Down
2 changes: 1 addition & 1 deletion cmd/serve_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ func serve(ctx context.Context) {
defer db.Close()

addr := net.JoinHostPort(config.API.Host, config.API.Port)
logrus.Infof("GoTrue API started on: %s", addr)

opts := []api.Option{
api.NewLimiterOptions(config),
}
a := api.NewAPIWithVersion(config, db, utilities.Version, opts...)
ah := reloader.NewAtomicHandler(a)
logrus.WithField("version", a.Version()).Infof("GoTrue API started on: %s", addr)

baseCtx, baseCancel := context.WithCancel(context.Background())
defer baseCancel()
Expand Down
4 changes: 4 additions & 0 deletions internal/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ type API struct {
limiterOpts *LimiterOptions
}

func (a *API) Version() string {
return a.version
}

func (a *API) Now() time.Time {
if a.overrideTime != nil {
return a.overrideTime()
Expand Down

0 comments on commit 8078cdc

Please sign in to comment.