feat: 初始化平台总后台与核心API
This commit is contained in:
19
backend/internal/config/config.go
Normal file
19
backend/internal/config/config.go
Normal file
@@ -0,0 +1,19 @@
|
||||
// Package config 提供运行配置,不在代码或仓库中保存真实密钥。
|
||||
package config
|
||||
|
||||
import "os"
|
||||
|
||||
// Config 是 API 进程的最小运行配置。
|
||||
type Config struct {
|
||||
DatabaseURL string
|
||||
Port string
|
||||
}
|
||||
|
||||
// Load 读取环境变量并提供适用于本地开发的端口默认值。
|
||||
func Load() Config {
|
||||
port := os.Getenv("PORT")
|
||||
if port == "" {
|
||||
port = "8080"
|
||||
}
|
||||
return Config{DatabaseURL: os.Getenv("DATABASE_URL"), Port: port}
|
||||
}
|
||||
Reference in New Issue
Block a user