feat: add ability to override the UI configuration with environment variables

This commit is contained in:
Elias Schneider
2025-02-12 14:20:52 +01:00
parent 2d78349b38
commit 4e858420e9
5 changed files with 65 additions and 21 deletions

View File

@@ -25,6 +25,7 @@ type EnvConfigSchema struct {
Host string `env:"HOST"`
MaxMindLicenseKey string `env:"MAXMIND_LICENSE_KEY"`
GeoLiteDBPath string `env:"GEOLITE_DB_PATH"`
UiConfigDisabled bool `env:"PUBLIC_UI_CONFIG_DISABLED"`
}
var EnvConfig = &EnvConfigSchema{
@@ -38,6 +39,7 @@ var EnvConfig = &EnvConfigSchema{
Host: "0.0.0.0",
MaxMindLicenseKey: "",
GeoLiteDBPath: "data/GeoLite2-City.mmdb",
UiConfigDisabled: false,
}
func init() {

View File

@@ -184,3 +184,10 @@ func (e *OidcAccessDeniedError) Error() string {
}
func (e *OidcAccessDeniedError) HttpStatusCode() int { return http.StatusForbidden }
type UiConfigDisabledError struct{}
func (e *UiConfigDisabledError) Error() string {
return "The configuration can't be changed since the UI configuration is disabled"
}
func (e *UiConfigDisabledError) HttpStatusCode() int { return http.StatusForbidden }