Skip to content

Commit

Permalink
fix database config parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
c9s committed Jan 26, 2024
1 parent 2742b19 commit 93bddfd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pkg/bbgo/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,10 @@ type ServiceConfig struct {
}

type DatabaseConfig struct {
Driver string `json:"driver"`
DSN string `json:"dsn"`
Driver string `json:"driver" yaml:"driver"`
DSN string `json:"dsn" yaml:"dsn"`

ExtraMigrationPackages []string `json:"extraMigrationPackages"`
ExtraMigrationPackages []string `json:"extraMigrationPackages" yaml:"extraMigrationPackages"`
}

type EnvironmentConfig struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/bbgo/environment.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,13 +198,13 @@ func (environ *Environment) ConfigureDatabase(ctx context.Context, config *Confi

func (environ *Environment) ConfigureDatabaseDriver(ctx context.Context, driver string, dsn string, extraPkgNames ...string) error {
environ.DatabaseService = service.NewDatabaseService(driver, dsn)
environ.DatabaseService.AddMigrationPackages(extraPkgNames...)

err := environ.DatabaseService.Connect()
if err != nil {
return err
}

environ.DatabaseService.AddMigrationPackages(extraPkgNames...)

if err := environ.DatabaseService.Upgrade(ctx); err != nil {
return err
}
Expand Down

0 comments on commit 93bddfd

Please sign in to comment.