feat(platform): expose amap server readiness
This commit is contained in:
@@ -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"),
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user