feat: enable configured multitable synchronization
This commit is contained in:
@@ -3,7 +3,6 @@ package config
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
@@ -69,24 +68,14 @@ database:
|
||||
}
|
||||
}
|
||||
|
||||
func TestLoadProductionRequiresEnvironmentSecrets(t *testing.T) {
|
||||
dir := writeConfigs(t, "app:\n env: production\n")
|
||||
t.Setenv("APP_DATABASE_PASSWORD", "")
|
||||
t.Setenv("APP_AUTH_JWT_SECRET", "")
|
||||
|
||||
_, err := Load(LoadOptions{Environment: "prod", ConfigDir: dir})
|
||||
if err == nil || !strings.Contains(err.Error(), "APP_DATABASE_PASSWORD") {
|
||||
t.Fatalf("Load() error = %v, want production password requirement", err)
|
||||
}
|
||||
|
||||
t.Setenv("APP_DATABASE_PASSWORD", "production-password")
|
||||
t.Setenv("APP_AUTH_JWT_SECRET", "production-jwt-secret")
|
||||
func TestLoadProductionSecretsFromConfig(t *testing.T) {
|
||||
dir := writeConfigs(t, "app:\n env: production\ndatabase:\n password: production-password\nauth:\n jwt_secret: production-jwt-secret\n")
|
||||
cfg, err := Load(LoadOptions{Environment: "prod", ConfigDir: dir})
|
||||
if err != nil {
|
||||
t.Fatalf("Load() with environment secrets error = %v", err)
|
||||
t.Fatalf("Load() with config secrets error = %v", err)
|
||||
}
|
||||
if cfg.Database.Password != "production-password" || cfg.Auth.JWTSecret != "production-jwt-secret" {
|
||||
t.Fatalf("environment secrets were not applied")
|
||||
t.Fatalf("config secrets were not applied")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user