update config

This commit is contained in:
ivamp 2024-06-16 14:09:20 +08:00
parent f305bc6ce6
commit 1ba6412b24
3 changed files with 16 additions and 3 deletions

View File

@ -8,10 +8,10 @@ REDIS_PASS=
JWKS_URL=https://auth.leaflow.cn/realms/Ecosystem/protocol/openid-connect/certs JWKS_URL=https://auth.leaflow.cn/realms/Ecosystem/protocol/openid-connect/certs
S3_ENDPOINT= S3_ENDPOINT=
S3_ACCESS_KEY= S3_ACCESS_KEY_ID=
S3_SECRET_KEY= S3_SECRET_ACCESS_KEY=
S3_BUCKET= S3_BUCKET=
S3_USE_SSL=false S3_USE_SSL=true
DEBUG=false DEBUG=false

View File

@ -32,6 +32,14 @@ type defaultConfig struct {
DebugMode struct { DebugMode struct {
Enable bool Enable bool
} }
S3 struct {
Endpoint string
Bucket string
AccessKeyID string
SecretAccessKey string
UseSSL bool
}
} }
var Config = defaultConfig{} var Config = defaultConfig{}

View File

@ -17,6 +17,11 @@ func InitConfig() {
Config.ListenAddr.HTTP = GetEnv("HTTP_LISTEN_ADDR") Config.ListenAddr.HTTP = GetEnv("HTTP_LISTEN_ADDR")
Config.JWKS.Url = GetEnv("JWKS_URL") Config.JWKS.Url = GetEnv("JWKS_URL")
Config.DebugMode.Enable = GetEnv("DEBUG", "false") == "true" Config.DebugMode.Enable = GetEnv("DEBUG", "false") == "true"
Config.S3.Endpoint = GetEnv("S3_ENDPOINT")
Config.S3.Bucket = GetEnv("S3_BUCKET")
Config.S3.AccessKeyID = GetEnv("S3_ACCESS_KEY_ID")
Config.S3.SecretAccessKey = GetEnv("S3_SECRET_ACCESS_KEY")
Config.S3.UseSSL = GetEnv("S3_USE_SSL", "true") == "true"
dsn := dsnparser.Parse(Config.DB.DSN) dsn := dsnparser.Parse(Config.DB.DSN)
var dsn2 = "" var dsn2 = ""