feat(platform): expose amap server readiness

This commit is contained in:
lingniu
2026-07-04 17:53:03 +08:00
parent aa384732ef
commit eb8f15ca18
10 changed files with 39 additions and 8 deletions

View File

@@ -21,6 +21,7 @@ type Config struct {
AuthToken string
RequestTimeout time.Duration
AMapWebJSKey string
AMapAPIKey string
AMapSecurityCode string
AMapServiceHost string
PlatformRelease string
@@ -42,6 +43,7 @@ func Load() Config {
AuthToken: os.Getenv("AUTH_TOKEN"),
RequestTimeout: time.Duration(envInt("REQUEST_TIMEOUT_MS", 5000)) * time.Millisecond,
AMapWebJSKey: os.Getenv("AMAP_WEB_JS_KEY"),
AMapAPIKey: os.Getenv("AMAP_API_KEY"),
AMapSecurityCode: os.Getenv("AMAP_SECURITY_JS_CODE"),
AMapServiceHost: os.Getenv("AMAP_SECURITY_SERVICE_HOST"),
PlatformRelease: os.Getenv("PLATFORM_RELEASE"),

View File

@@ -24,3 +24,13 @@ func TestLoadReadsPlatformRelease(t *testing.T) {
t.Fatalf("PlatformRelease = %q", cfg.PlatformRelease)
}
}
func TestLoadReadsAMapServerAPIKey(t *testing.T) {
t.Setenv("AMAP_API_KEY", "server-map-key")
cfg := Load()
if cfg.AMapAPIKey != "server-map-key" {
t.Fatalf("AMapAPIKey = %q", cfg.AMapAPIKey)
}
}