diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2024-08-18 14:51:00 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-18 14:51:00 -0400 |
| commit | d2186ed58d907a81648aa62ffa17ec20fb2d213e (patch) | |
| tree | a5b2e26f1f96f333d48a8b20126ecc9ead697029 /internal/configloader/configloader.go | |
| parent | Multiple issue fixes in readme (#3) (diff) | |
| download | cli-d2186ed58d907a81648aa62ffa17ec20fb2d213e.zip | |
GH-4: Add configurable migrations table name (#6)
* Add configurable migrations table name
* Update codecov to be informational
* Add mockdb and couple of extra tests
* remove extra files
* Add list query error test
* Add readme update for custom migration table
Diffstat (limited to 'internal/configloader/configloader.go')
| -rw-r--r-- | internal/configloader/configloader.go | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/internal/configloader/configloader.go b/internal/configloader/configloader.go index c13977a..0f724a6 100644 --- a/internal/configloader/configloader.go +++ b/internal/configloader/configloader.go @@ -54,12 +54,13 @@ type MigrationsConfig struct { } type ConnectionConfig struct { - Host string `toml:"host" envconfig:"BOLT_DB_HOST"` - Port string `toml:"port" envconfig:"BOLT_DB_PORT"` - User string `toml:"user" envconfig:"BOLT_DB_USER"` - Password string `toml:"password" envconfig:"BOLT_DB_PASSWORD"` - DBName string `toml:"dbname" envconfig:"BOLT_DB_NAME"` - Driver string `toml:"driver" envconfig:"BOLT_DB_DRIVER"` + Host string `toml:"host" envconfig:"BOLT_DB_HOST"` + Port string `toml:"port" envconfig:"BOLT_DB_PORT"` + User string `toml:"user" envconfig:"BOLT_DB_USER"` + Password string `toml:"password" envconfig:"BOLT_DB_PASSWORD"` + DBName string `toml:"dbname" envconfig:"BOLT_DB_NAME"` + Driver string `toml:"driver" envconfig:"BOLT_DB_DRIVER"` + MigrationsTable string `toml:"migrations_table" envconfig:"BOLT_DB_MIGRATIONS_TABLE"` } func NewConfig() (*Config, error) { @@ -73,6 +74,9 @@ func NewConfig() (*Config, error) { DirectoryPath: "migrations", VersionStyle: VersionStyleTimestamp, }, + Connection: ConnectionConfig{ + MigrationsTable: "bolt_migrations", + }, } if !errors.Is(err, ErrConfigFileNotFound) { _, err = toml.DecodeFile(filePath, &cfg) |