diff --git a/consul/consul.go b/consul/consul.go index 42c1dfa..0e68817 100644 --- a/consul/consul.go +++ b/consul/consul.go @@ -151,8 +151,7 @@ func loadConfigFromConsul() { fmt.Printf("服务名称: %s, 环境变量 APP_ENV: %s\n", serviceName, env) if env == "" { - fmt.Printf("未设置 APP_ENV 环境变量,跳过 Consul 配置加载\n") - return + panic("未设置 APP_ENV 环境变量,无法从 Consul 加载配置") } consulData, lastIndex, err := loadEnvFromConsul(env, serviceName)