修复 curve 接口的一些问题
This commit is contained in:
+16
-14
@@ -7,13 +7,14 @@ import (
|
||||
)
|
||||
|
||||
type Config struct {
|
||||
Env string
|
||||
Host string
|
||||
Port int
|
||||
Database DatabaseConfig
|
||||
Meilisearch MeilisearchConfig
|
||||
Redis RedisConfig
|
||||
Equalize EqualizeConfig
|
||||
Env string
|
||||
Host string
|
||||
Port int
|
||||
Database DatabaseConfig
|
||||
Meilisearch MeilisearchConfig
|
||||
Redis RedisConfig
|
||||
Equalize EqualizeConfig
|
||||
EnablePersistTask bool
|
||||
}
|
||||
|
||||
func Load() (*Config, error) {
|
||||
@@ -45,13 +46,14 @@ func Load() (*Config, error) {
|
||||
eq := loadEqualize(env)
|
||||
|
||||
return &Config{
|
||||
Env: env,
|
||||
Host: getEnv("APP_HOST", "0.0.0.0"),
|
||||
Port: port,
|
||||
Database: db,
|
||||
Meilisearch: ms,
|
||||
Redis: rd,
|
||||
Equalize: eq,
|
||||
Env: env,
|
||||
Host: getEnv("APP_HOST", "0.0.0.0"),
|
||||
Port: port,
|
||||
Database: db,
|
||||
Meilisearch: ms,
|
||||
Redis: rd,
|
||||
Equalize: eq,
|
||||
EnablePersistTask: getEnv("ENABLE_PERSIST_TASK", "false") == "true",
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
||||
+10
-10
@@ -3,32 +3,32 @@ package config
|
||||
import "os"
|
||||
|
||||
type EqualizeConfig struct {
|
||||
APIURL string
|
||||
APIURL string
|
||||
MeasurementBasePath string
|
||||
TargetBasePath 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", ""),
|
||||
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", "/app/measurements"),
|
||||
TargetBasePath: getEnv("TARGET_BASE_PATH", "/app/targets"),
|
||||
}
|
||||
}
|
||||
|
||||
switch env {
|
||||
case "production":
|
||||
return EqualizeConfig{
|
||||
APIURL: "https://autoeq.app/equalize",
|
||||
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", ""),
|
||||
TargetBasePath: getEnv("TARGET_BASE_PATH", ""),
|
||||
APIURL: "http://172.31.18.70:8000/equalize",
|
||||
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", "/app/measurements"),
|
||||
TargetBasePath: getEnv("TARGET_BASE_PATH", "/app/targets"),
|
||||
}
|
||||
default:
|
||||
return EqualizeConfig{
|
||||
APIURL: "https://autoeq.app/equalize",
|
||||
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", ""),
|
||||
TargetBasePath: getEnv("TARGET_BASE_PATH", ""),
|
||||
MeasurementBasePath: getEnv("MEASUREMENT_BASE_PATH", "/app/measurements"),
|
||||
TargetBasePath: getEnv("TARGET_BASE_PATH", "/app/targets"),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user