updates on the ai and agent and all thse things awith onboarding

This commit is contained in:
2026-09-30 14:47:58 +05:30
parent 44ba33eda2
commit 0ac5d3d54f
37 changed files with 7755 additions and 0 deletions

View File

@@ -82,6 +82,39 @@ func TestEnvironmentOverridesAreRead(t *testing.T) {
}
}
// Production must not boot on a secret whose fallback is committed to the repo.
func TestMissingProductionSecrets(t *testing.T) {
setEnv(t, "ENV", "production")
setEnv(t, "JWT_SECRET_KEY", "")
setEnv(t, "DB_PASSWORD", "set")
setEnv(t, "NATS_PASSWORD", "")
got := Load().MissingProductionSecrets()
if len(got) != 2 || got[0] != "JWT_SECRET_KEY" || got[1] != "NATS_PASSWORD" {
t.Fatalf("missing = %v, want [JWT_SECRET_KEY NATS_PASSWORD]", got)
}
setEnv(t, "JWT_SECRET_KEY", "set")
setEnv(t, "NATS_PASSWORD", "set")
if got := Load().MissingProductionSecrets(); len(got) != 0 {
t.Errorf("all secrets set, still reported missing: %v", got)
}
}
// Outside production the fallbacks are allowed, so local development runs
// with no .env at all.
func TestMissingProductionSecretsIgnoredOutsideProduction(t *testing.T) {
setEnv(t, "JWT_SECRET_KEY", "")
setEnv(t, "DB_PASSWORD", "")
setEnv(t, "NATS_PASSWORD", "")
for _, env := range []string{"", "development", "staging"} {
setEnv(t, "ENV", env)
if got := Load().MissingProductionSecrets(); len(got) != 0 {
t.Errorf("ENV=%q reported missing secrets %v; only production should", env, got)
}
}
}
// An empty env var must fall through to the default rather than blanking the
// setting — an empty DB host is a service that cannot start with no clue why.
func TestEmptyEnvFallsBackToTheDefault(t *testing.T) {