@@ -17,6 +17,8 @@ type Runtime struct {
|
||||
ClientSubmitIntervalSec int `json:"client_submit_interval_sec"`
|
||||
GuessLotteryWindowSec int `json:"guess_lottery_window_sec"`
|
||||
GuessLotteryMaxAccepted int `json:"guess_lottery_max_accepted"`
|
||||
BeaconHuntEnabled int `json:"beacon_hunt_enabled"`
|
||||
BeaconBonusWeight int `json:"beacon_bonus_weight"`
|
||||
SybilProofOfWorkBits int `json:"sybil_pow_bits"`
|
||||
SybilWarmupSec int `json:"sybil_warmup_sec"`
|
||||
OpenAIMaxCalls1H int `json:"openai_max_calls_1h"`
|
||||
@@ -76,6 +78,8 @@ func Defaults() Runtime {
|
||||
ClientSubmitIntervalSec: envInt("DEFAULT_CLIENT_SUBMIT_INTERVAL_SEC", 11),
|
||||
GuessLotteryWindowSec: envInt("DEFAULT_GUESS_LOTTERY_WINDOW_SEC", 60),
|
||||
GuessLotteryMaxAccepted: envInt("DEFAULT_GUESS_LOTTERY_MAX_ACCEPTED", 0),
|
||||
BeaconHuntEnabled: envInt("DEFAULT_BEACON_HUNT_ENABLED", 0),
|
||||
BeaconBonusWeight: envInt("DEFAULT_BEACON_BONUS_WEIGHT", 2),
|
||||
SybilProofOfWorkBits: envInt("DEFAULT_SYBIL_POW_BITS", 15),
|
||||
SybilWarmupSec: envInt("DEFAULT_SYBIL_WARMUP_SEC", 15),
|
||||
OpenAIMaxCalls1H: envInt("DEFAULT_OPENAI_MAX_CALLS_1H", 20),
|
||||
@@ -230,6 +234,12 @@ func Validate(v Runtime) error {
|
||||
if v.GuessLotteryMaxAccepted < 0 || v.GuessLotteryMaxAccepted > 100000 {
|
||||
return fmt.Errorf("guess_lottery_max_accepted must be 0..100000 (0 disables lottery)")
|
||||
}
|
||||
if v.BeaconHuntEnabled < 0 || v.BeaconHuntEnabled > 1 {
|
||||
return fmt.Errorf("beacon_hunt_enabled must be 0 or 1")
|
||||
}
|
||||
if v.BeaconBonusWeight < 1 || v.BeaconBonusWeight > 10 {
|
||||
return fmt.Errorf("beacon_bonus_weight must be 1..10")
|
||||
}
|
||||
if v.SybilProofOfWorkBits < 0 || v.SybilProofOfWorkBits > 22 {
|
||||
return fmt.Errorf("sybil_pow_bits must be 0..22")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user