fix(captcha): exit non-zero on misconfig, tighten solver gate tests

This commit is contained in:
Rustem Kamalov
2026-04-20 20:12:19 +03:00
parent 1842c4bb07
commit 08edec5779
14 changed files with 453 additions and 39 deletions

View File

@@ -14,7 +14,7 @@ import (
)
const (
version = "0.6.4"
version = "0.6.5"
defaultConfigFilename = "config"
envPrefix = "OPENSERP"
)
@@ -27,6 +27,7 @@ type Config struct {
Resilience ResilienceConfig `mapstructure:"resilience"`
CircuitBreaker CircuitBreakerConfig `mapstructure:"circuit_breaker"`
CORS CORSConfig `mapstructure:"cors"`
Captcha CaptchaConfig `mapstructure:"captcha"`
Config2Capcha Config2Captcha `mapstructure:"2captcha"`
GoogleConfig EngineConfig `mapstructure:"google"`
YandexConfig EngineConfig `mapstructure:"yandex"`
@@ -87,6 +88,10 @@ type CORSConfig struct {
MaxAge int `mapstructure:"max_age"`
}
type CaptchaConfig struct {
SolverEnabled bool `mapstructure:"solver_enabled"`
}
var config = Config{}
var flagToConfigKey = map[string]string{
@@ -322,6 +327,7 @@ func setConfigDefaults(v *viper.Viper) {
v.SetDefault("cors.allow_methods", "GET, POST, OPTIONS")
v.SetDefault("cors.allow_headers", "Origin, Content-Type, Accept, Authorization, X-Use-Proxy")
v.SetDefault("cors.max_age", 86400)
v.SetDefault("captcha.solver_enabled", false)
}
func init() {