You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

39 rivejä
1.2 KiB

  1. package system_setting
  2. import "github.com/QuantumNous/new-api/setting/config"
  3. // RegionSyncSettings 跨地区同步配置
  4. type RegionSyncSettings struct {
  5. Enabled bool `json:"enabled"`
  6. RegionId string `json:"region_id"`
  7. IsMaster bool `json:"is_master"`
  8. MasterEndpoint string `json:"master_endpoint"`
  9. SlaveEndpoints []string `json:"slave_endpoints"`
  10. SyncApiKey string `json:"sync_api_key"`
  11. MinBalanceThreshold int `json:"min_balance_threshold"`
  12. SyncIntervalSeconds int `json:"sync_interval_seconds"`
  13. MaxRetryCount int `json:"max_retry_count"`
  14. SyncBatchSize int `json:"sync_batch_size"`
  15. QuotaSyncIntervalSeconds int `json:"quota_sync_interval_seconds"` // 余额同步间隔(秒)
  16. DisableCachedConsume bool `json:"disable_cached_consume"`
  17. }
  18. var defaultRegionSyncSettings = RegionSyncSettings{
  19. Enabled: false,
  20. MinBalanceThreshold: 100000,
  21. SyncIntervalSeconds: 60,
  22. MaxRetryCount: 3,
  23. SyncBatchSize: 100,
  24. QuotaSyncIntervalSeconds: 300,
  25. }
  26. func init() {
  27. config.GlobalConfig.Register("region_sync", &defaultRegionSyncSettings)
  28. }
  29. func GetRegionSyncSettings() *RegionSyncSettings {
  30. return &defaultRegionSyncSettings
  31. }