Files
SafeLine/management/webserver/pkg/config/db.go
T
Binbim b8788c239e
MCP Docker / build-and-push (push) Has been cancelled
feat: SafeLine CE 9.3.9 with pro features
- Remove telemetry: disabled all phone-home (installation notify, false positives, behavior tracking, upgrade tips)
- Version branding: removed 'ce-' prefix, product name changed to '长亭雷池 WAF'
- Detection engine enhancement: strict preset enables all 17 modules with aggressive configs
- Multi-user RBAC: admin/operator/viewer roles with password + TOTP 2FA
- Rate limiting: nginx limit_req per website (RPS, burst, action)
- JS Challenge: browser fingerprint verification page with cookie-based bypass
- Security fixes: removed InsecureSkipVerify, hardcoded credentials, NO_AUTH backdoor
2026-07-04 07:59:04 +08:00

46 lines
770 B
Go

package config
import (
"net/url"
"os"
"chaitin.cn/dev/go/settings"
)
type DBConfig struct {
URL string `yaml:"url"`
LogSQL bool `yaml:"log_sql"`
SSLMode bool `yaml:"ssl_mode"`
}
func DefaultDBConfig() DBConfig {
return DBConfig{
URL: "postgres://safeline-ce:safeline-ce@127.0.0.1/safeline-ce",
LogSQL: false,
SSLMode: false,
}
}
func (dbc *DBConfig) Load(setting *settings.Setting) error {
if err := setting.Unmarshal("db", dbc); err != nil {
return err
}
if v, ok := os.LookupEnv("DATABASE_URL"); ok {
dbc.URL = v
}
dbURL, err := url.Parse(dbc.URL)
if err != nil {
return err
}
q := dbURL.Query()
if !dbc.SSLMode {
q.Set("sslmode", "disable")
}
dbURL.RawQuery = q.Encode()
dbc.URL = dbURL.String()
return nil
}