feat: add TRUSTED_PLATFORM environment variable for gin (#1372)

This commit is contained in:
Chotow
2026-03-27 01:44:31 +08:00
committed by GitHub
parent 5251cd9799
commit 0551502586
2 changed files with 5 additions and 0 deletions

View File

@@ -49,6 +49,10 @@ func initRouter(db *gorm.DB, svc *services) (utils.Service, error) {
_ = r.SetTrustedProxies(nil) _ = r.SetTrustedProxies(nil)
} }
if common.EnvConfig.TrustedPlatform != "" {
r.TrustedPlatform = common.EnvConfig.TrustedPlatform
}
if common.EnvConfig.TracingEnabled { if common.EnvConfig.TracingEnabled {
r.Use(otelgin.Middleware(common.Name)) r.Use(otelgin.Middleware(common.Name))
} }

View File

@@ -44,6 +44,7 @@ type EnvConfigSchema struct {
DbProvider DbProvider DbProvider DbProvider
DbConnectionString string `env:"DB_CONNECTION_STRING" options:"file"` DbConnectionString string `env:"DB_CONNECTION_STRING" options:"file"`
TrustProxy bool `env:"TRUST_PROXY"` TrustProxy bool `env:"TRUST_PROXY"`
TrustedPlatform string `env:"TRUSTED_PLATFORM"`
AuditLogRetentionDays int `env:"AUDIT_LOG_RETENTION_DAYS"` AuditLogRetentionDays int `env:"AUDIT_LOG_RETENTION_DAYS"`
AnalyticsDisabled bool `env:"ANALYTICS_DISABLED"` AnalyticsDisabled bool `env:"ANALYTICS_DISABLED"`
AllowDowngrade bool `env:"ALLOW_DOWNGRADE"` AllowDowngrade bool `env:"ALLOW_DOWNGRADE"`