Исправления в ветке main

This commit is contained in:
2025-11-09 15:01:28 +06:00
parent 8348cac2aa
commit 7b7142a5c3
10 changed files with 97 additions and 69 deletions

View File

@@ -58,6 +58,7 @@ type ServerConfig struct {
CookieSecure bool
CookiePath string
CookieTTLHours int
ForceNoCSRF bool
}
type ValidationConfig struct {
@@ -166,6 +167,7 @@ func Load() Config {
BasePath: getEnv("LCG_BASE_URL", "/lcg"),
HealthUrl: getEnv("LCG_HEALTH_URL", "/api/v1/protected/sberchat/health"),
ProxyUrl: getEnv("LCG_PROXY_URL", "/api/v1/protected/sberchat/chat"),
ForceNoCSRF: isForceNoCSRF(),
},
Validation: ValidationConfig{
MaxSystemPromptLength: getEnvInt("LCG_MAX_SYSTEM_PROMPT_LENGTH", 2000),
@@ -214,6 +216,15 @@ func isCookieSecure() bool {
return vLower == "1" || vLower == "true"
}
func isForceNoCSRF() bool {
v := strings.TrimSpace(getEnv("LCG_FORCE_NO_CSRF", ""))
if v == "" {
return false
}
vLower := strings.ToLower(v)
return vLower == "1" || vLower == "true"
}
var AppConfig Config
func init() {