init: AIGC-Hub/AVCC 方案文档 + TCS-IPTV 内容可信锁定系统 MVP
- 方案文档: AVCC 体系建设、IPTV TCS 需求(0-req)/PRD(1-prd)/任务(2-task)/二三四期任务 - tcs-iptv: Go 后端(哈希SDK/MA码生成/可信数据空间mock/业务编排/HTTP API+HMAC鉴权) - web-console: React+AntD 监管大屏(角色工作台/全流程演示/监管片库) - 一剧一码+集级哈希, 集级下架/恢复, 全栈测试通过
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"os"
|
||||
)
|
||||
|
||||
// Config 保存服务运行所需的通用配置。
|
||||
// MVP 阶段从环境变量加载,缺省值适配本地开发。
|
||||
type Config struct {
|
||||
APIAddr string
|
||||
ChainAddr string
|
||||
HashAddr string
|
||||
PostgresDSN string
|
||||
RedisAddr string
|
||||
}
|
||||
|
||||
func getEnv(key, def string) string {
|
||||
if v := os.Getenv(key); v != "" {
|
||||
return v
|
||||
}
|
||||
return def
|
||||
}
|
||||
|
||||
// Load 从环境变量加载配置。
|
||||
func Load() Config {
|
||||
return Config{
|
||||
APIAddr: getEnv("TCS_API_ADDR", ":8080"),
|
||||
ChainAddr: getEnv("TCS_CHAIN_ADDR", ":8081"),
|
||||
HashAddr: getEnv("TCS_HASH_ADDR", ":8082"),
|
||||
PostgresDSN: getEnv("TCS_POSTGRES_DSN", "postgres://postgres@localhost:5432/tcs_iptv?sslmode=disable"),
|
||||
RedisAddr: getEnv("TCS_REDIS_ADDR", "localhost:6379"),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user