feat: add admin panel with multi-chain support and notification system
- Add full admin REST API: auth, API keys, chains, chain tokens, wallets, orders, RPC nodes, settings, dashboard stats, notifications - Add JWT-based admin authentication and API key auth middleware - Add multi-chain listeners: BSC, ETH, Polygon, Plasma, EVM WebSocket - Add RPC node health check job with automatic failover - Add Telegram notification channel for order events - Add installer for first-run database initialization - Add new DB models: admin_user, api_key, chain, chain_token, rpc_node, settings, notification_channel - Add order statistics aggregation (daily/monthly/by-chain) - Serve built admin SPA from embedded www/ assets - Add comprehensive test coverage for all new features
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
package config
|
||||
|
||||
// Settings lookups are injected at runtime by bootstrap (after DB init)
|
||||
// to keep the config package free of a `model/data` import, which would
|
||||
// create a cycle via `model/dao -> config`.
|
||||
//
|
||||
// If unset (e.g. during early startup or tests) the getters return the
|
||||
// zero string / 0 and callers fall through to the .env / default path.
|
||||
|
||||
// SettingsGetString is installed by bootstrap.Init with a closure that
|
||||
// reads from the settings table. Runtime-only.
|
||||
var SettingsGetString func(key string) string
|
||||
|
||||
func settingsRateApiUrl() string {
|
||||
if SettingsGetString == nil {
|
||||
return ""
|
||||
}
|
||||
return SettingsGetString("rate.api_url")
|
||||
}
|
||||
|
||||
func settingsForcedUsdtRate() float64 {
|
||||
if SettingsGetString == nil {
|
||||
return 0
|
||||
}
|
||||
raw := SettingsGetString("rate.forced_usdt_rate")
|
||||
if raw == "" {
|
||||
return 0
|
||||
}
|
||||
f, err := parseFloat(raw)
|
||||
if err != nil {
|
||||
return 0
|
||||
}
|
||||
return f
|
||||
}
|
||||
Reference in New Issue
Block a user