feat: add runtime log level settings

This commit is contained in:
line-6000
2026-06-12 00:49:18 +08:00
parent 9b397bd45e
commit 9ac9894dba
148 changed files with 486 additions and 172 deletions
+9 -4
View File
@@ -4,10 +4,10 @@ package mdb
// Groups: brand, rate, system, epay, okpay. Merchant credentials (pid +
// secret_key) live in the api_keys table; notification configs live in
// NotificationChannel.
// Default rows for the epay/okpay groups are seeded on first startup (see
// model/dao/mdb_table_init.go seedDefaultSettings). All other groups start
// empty and fall back to hardcoded defaults until an admin sets them.
// Only exception: system.jwt_secret is auto-generated on first startup.
// Default rows for the system/epay/okpay groups are seeded on first startup
// (see model/dao/mdb_table_init.go seedDefaultSettings). Other groups start
// empty and fall back to hardcoded defaults until an admin sets them. The
// system.jwt_secret key is auto-generated on first startup.
const (
SettingGroupBrand = "brand"
SettingGroupRate = "rate"
@@ -31,6 +31,7 @@ const (
SettingKeyInitAdminPasswordChanged = "system.init_admin_password_changed"
SettingKeyOrderExpiration = "system.order_expiration_time"
SettingKeyAmountPrecision = "system.amount_precision"
SettingKeySystemLogLevel = "system.log_level"
SettingKeyBrandCheckoutName = "brand.checkout_name"
SettingKeyBrandSiteName = "brand.site_name"
SettingKeyBrandLogoUrl = "brand.logo_url"
@@ -62,6 +63,10 @@ const (
SettingKeyOkPayAllowTokens = "okpay.allow_tokens"
)
const (
SettingDefaultSystemLogLevel = "error"
)
type Setting struct {
Group string `gorm:"column:group;size:32;index:settings_group_index" json:"group" enums:"brand,rate,system,epay,okpay" example:"rate"`
Key string `gorm:"column:key;uniqueIndex:settings_key_uindex;size:128" json:"key" example:"rate.forced_rate_list"`