diff options
Diffstat (limited to 'internal/configloader')
| -rw-r--r-- | internal/configloader/configloader.go | 1 | ||||
| -rw-r--r-- | internal/configloader/configloader_test.go | 6 |
2 files changed, 7 insertions, 0 deletions
diff --git a/internal/configloader/configloader.go b/internal/configloader/configloader.go index 96bab00..8057ee2 100644 --- a/internal/configloader/configloader.go +++ b/internal/configloader/configloader.go @@ -55,6 +55,7 @@ type MigrationsConfig struct { type ConnectionConfig struct { Host string `toml:"host" envconfig:"BOLT_DB_CONN_HOST"` + Port string `toml:"port" envconfig:"BOLT_DB_CONN_PORT"` User string `toml:"user" envconfig:"BOLT_DB_CONN_USER"` Password string `toml:"password" envconfig:"BOLT_DB_CONN_PASSWORD"` DBName string `toml:"dbname" envconfig:"BOLT_DB_CONN_DBNAME"` diff --git a/internal/configloader/configloader_test.go b/internal/configloader/configloader_test.go index 0c89672..6a27d86 100644 --- a/internal/configloader/configloader_test.go +++ b/internal/configloader/configloader_test.go @@ -36,6 +36,7 @@ func TestNewConfigWithInvalidVersionStyle(t *testing.T) { func TestNewConfigFindsFileAndPopulatesConfigStruct(t *testing.T) { bolttest.UnsetEnv(t, "BOLT_DB_CONN_HOST") + bolttest.UnsetEnv(t, "BOLT_DB_CONN_PORT") bolttest.UnsetEnv(t, "BOLT_DB_CONN_USER") bolttest.UnsetEnv(t, "BOLT_DB_CONN_PASSWORD") bolttest.UnsetEnv(t, "BOLT_DB_CONN_DBNAME") @@ -49,6 +50,7 @@ func TestNewConfigFindsFileAndPopulatesConfigStruct(t *testing.T) { }, Connection: configloader.ConnectionConfig{ Host: "testhost", + Port: "1234", User: "testuser", Password: "testpassword", DBName: "testdb", @@ -73,6 +75,7 @@ func TestNewConfigCanBeOverridenByEnvVars(t *testing.T) { }, Connection: configloader.ConnectionConfig{ Host: "testhost", + Port: "1234", User: "testuser", Password: "testpassword", DBName: "testdb", @@ -88,6 +91,7 @@ func TestNewConfigCanBeOverridenByEnvVars(t *testing.T) { }, Connection: configloader.ConnectionConfig{ Host: "envtesthost", + Port: "4321", User: "envtestuser", Password: "envtestpassword", DBName: "envtestdb", @@ -97,6 +101,7 @@ func TestNewConfigCanBeOverridenByEnvVars(t *testing.T) { t.Setenv("BOLT_MIGRATIONS_VERSION_STYLE", string(envCfg.Migrations.VersionStyle)) t.Setenv("BOLT_MIGRATIONS_DIR_PATH", envCfg.Migrations.DirectoryPath) t.Setenv("BOLT_DB_CONN_HOST", envCfg.Connection.Host) + t.Setenv("BOLT_DB_CONN_PORT", envCfg.Connection.Port) t.Setenv("BOLT_DB_CONN_USER", envCfg.Connection.User) t.Setenv("BOLT_DB_CONN_PASSWORD", envCfg.Connection.Password) t.Setenv("BOLT_DB_CONN_DBNAME", envCfg.Connection.DBName) @@ -109,6 +114,7 @@ func TestNewConfigCanBeOverridenByEnvVars(t *testing.T) { func TestNewConfigSearchesParentDirectories(t *testing.T) { bolttest.UnsetEnv(t, "BOLT_DB_CONN_HOST") + bolttest.UnsetEnv(t, "BOLT_DB_CONN_PORT") bolttest.UnsetEnv(t, "BOLT_DB_CONN_USER") bolttest.UnsetEnv(t, "BOLT_DB_CONN_PASSWORD") bolttest.UnsetEnv(t, "BOLT_DB_CONN_DBNAME") |