mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-25 08:15:15 +00:00
fix database config parsing
This commit is contained in:
parent
2742b192b6
commit
93bddfdccd
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user