34 lines
873 B
Go
34 lines
873 B
Go
|
|
package config
|
||
|
|
|
||
|
|
import "os"
|
||
|
|
|
||
|
|
type EqualizeConfig struct {
|
||
|
|
APIURL string
|
||
|
|
MeasurementBasePath string
|
||
|
|
TargetBasePath string
|
||
|
|
}
|
||
|
|
|
||
|
|
func loadEqualize(env string) EqualizeConfig {
|
||
|
|
if os.Getenv("EQ_API_URL") != "" {
|
||
|
|
return EqualizeConfig{
|
||
|
|
APIURL: os.Getenv("EQ_API_URL"),
|
||
|
|
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", ""),
|
||
|
|
TargetBasePath: getEnv("TARGET_BASE_PATH", ""),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
switch env {
|
||
|
|
case "production":
|
||
|
|
return EqualizeConfig{
|
||
|
|
APIURL: "https://autoeq.app/equalize",
|
||
|
|
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", ""),
|
||
|
|
TargetBasePath: getEnv("TARGET_BASE_PATH", ""),
|
||
|
|
}
|
||
|
|
default:
|
||
|
|
return EqualizeConfig{
|
||
|
|
APIURL: "https://autoeq.app/equalize",
|
||
|
|
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", ""),
|
||
|
|
TargetBasePath: getEnv("TARGET_BASE_PATH", ""),
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|