Updating rate limits to also use TOML

This commit is contained in:
🐙PiperYxzzy
2025-10-13 20:53:49 +02:00
parent acd23c2f45
commit ff15c7a65f
9 changed files with 138 additions and 79 deletions

View File

@@ -8,22 +8,26 @@ import (
"github.com/BurntSushi/toml"
)
type DbConfig struct {
Dialect string `toml:"dialect"`
Username string `toml:"username"`
PasswordSecret string `toml:"password-secret"`
Url string `toml:"url"`
Port string `toml:"port"`
Name string `toml:"name"`
}
type StackConfiguration struct {
ConfigLoaded bool
AllowFreshAdminGeneration bool
AdminEmails []string
AdminHmacEnv string
UserHmacEnv string
AuthedRateLimitConfig string
UnauthedRateLimitConfig string
AllowFreshAdminGeneration bool `toml:"gen-fresh-admin"`
AdminEmails []string `toml:"admin-emails"`
AdminHmacEnv string `toml:"admin-hmac-env"`
UserHmacEnv string `toml:"user-hmac-env"`
AuthedRateLimitConfig string `toml:"auth-rate-limit-defs"`
UnauthedRateLimitConfig string `toml:"unauth-rate-limit-defs"`
DbDialect string
DbUsername string
DbPasswordSecret string
DbUrl string
DbPort string
DbName string
Db DbConfig `toml:"db"`
}
var Environment = os.Getenv("STACK_ENVIRONMENT")
@@ -60,5 +64,5 @@ func LoadConfig() {
configInternal.ConfigLoaded = true
log.Printf("Loaded Config for stack '%s': %+v", Environment, configInternal)
log.Printf("Loaded Config for stack '%s':\n%+v\n", Environment, configInternal)
}