2026-06-01 19:08:43 +08:00
|
|
|
package config
|
|
|
|
|
|
|
|
|
|
import "os"
|
|
|
|
|
|
|
|
|
|
type EqualizeConfig struct {
|
2026-06-04 19:39:08 +08:00
|
|
|
APIURL string
|
2026-06-01 19:08:43 +08:00
|
|
|
MeasurementBasePath string
|
2026-06-04 19:39:08 +08:00
|
|
|
TargetBasePath string
|
2026-06-01 19:08:43 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func loadEqualize(env string) EqualizeConfig {
|
|
|
|
|
if os.Getenv("EQ_API_URL") != "" {
|
|
|
|
|
return EqualizeConfig{
|
|
|
|
|
APIURL: os.Getenv("EQ_API_URL"),
|
2026-06-04 19:39:08 +08:00
|
|
|
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", "/app/measurements"),
|
|
|
|
|
TargetBasePath: getEnv("TARGET_BASE_PATH", "/app/targets"),
|
2026-06-01 19:08:43 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
switch env {
|
|
|
|
|
case "production":
|
|
|
|
|
return EqualizeConfig{
|
2026-06-04 19:39:08 +08:00
|
|
|
APIURL: "http://172.31.18.70:8000/equalize",
|
|
|
|
|
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", "/app/measurements"),
|
|
|
|
|
TargetBasePath: getEnv("TARGET_BASE_PATH", "/app/targets"),
|
2026-06-01 19:08:43 +08:00
|
|
|
}
|
|
|
|
|
default:
|
|
|
|
|
return EqualizeConfig{
|
|
|
|
|
APIURL: "https://autoeq.app/equalize",
|
2026-06-04 19:39:08 +08:00
|
|
|
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", "/app/measurements"),
|
|
|
|
|
TargetBasePath: getEnv("TARGET_BASE_PATH", "/app/targets"),
|
2026-06-01 19:08:43 +08:00
|
|
|
}
|
|
|
|
|
}
|
2026-06-04 19:39:08 +08:00
|
|
|
}
|