Add THRESHOLD_* env var support with BOUNDARY_* fallback

Introduce api.Getenv/api.LookupEnv which prefer THRESHOLD_X and fall back to legacy BOUNDARY_X; use them for user-facing env var reads.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
shadowdaoandClaude Sonnet 5.5 committed 2026-10-12 09:45:44 -07:00
1 parent eeb38a1a84
commit 306960d24b
16 files changed
+135 -57

No files matched your search

+24
View File
@@ -0,0 +1,24 @@
// Copyright (c) HashiCorp, Inc.
// SPDX-License-Identifier: BUSL-1.1
package api
import "testing"
func TestEnvFallback(t *testing.T) {
t.Setenv("THRESHOLD_ZZ_TEST", "")
t.Setenv("BOUNDARY_ZZ_TEST", "old")
if got := Getenv("BOUNDARY_ZZ_TEST"); got != "old" {
t.Fatalf("want old, got %q", got)
}
t.Setenv("THRESHOLD_ZZ_TEST", "new")
if got := Getenv("BOUNDARY_ZZ_TEST"); got != "new" {
t.Fatalf("want new, got %q", got)
}
if got, ok := LookupEnv("THRESHOLD_ZZ_TEST"); !ok || got != "new" {
t.Fatalf("want new, got %q %v", got, ok)
}
if PreferredEnvName("BOUNDARY_ADDR") != "THRESHOLD_ADDR" || LegacyEnvName("THRESHOLD_ADDR") != "BOUNDARY_ADDR" {
t.Fatal("name mapping")
}
}