Files
managed-portal/internal/config/config.go
2026-04-27 10:04:36 +08:00

30 lines
557 B
Go

package config
import "os"
type Config struct {
HTTPAddr string
WebDistDir string
RegistryPath string
}
func Load() *Config {
cfg := &Config{
HTTPAddr: ":8080",
WebDistDir: "web/dist",
RegistryPath: "managed_services.yaml",
}
if value := os.Getenv("MANAGED_PORTAL_HTTP_ADDR"); value != "" {
cfg.HTTPAddr = value
}
if value := os.Getenv("MANAGED_PORTAL_WEB_DIST_DIR"); value != "" {
cfg.WebDistDir = value
}
if value := os.Getenv("MANAGED_PORTAL_REGISTRY_PATH"); value != "" {
cfg.RegistryPath = value
}
return cfg
}