Make apiAllowedIPs optional

If our test and production instance just use *, one might as well make
that the default value. This should ease configuration for minimal
setups.
This commit is contained in:
Michael Panzlaff
2026-01-15 15:58:14 +01:00
parent 7db2bbe6b0
commit 489ad44b9f
2 changed files with 5 additions and 6 deletions

View File

@@ -616,9 +616,9 @@ func securedCheck(user *schema.User, r *http.Request) error {
} }
// If SplitHostPort fails, IPAddress is already just a host (no port) // If SplitHostPort fails, IPAddress is already just a host (no port)
// If nothing declared in config: deny all request to this api endpoint // If nothing declared in config: Continue
if len(config.Keys.APIAllowedIPs) == 0 { if len(config.Keys.APIAllowedIPs) == 0 {
return fmt.Errorf("missing configuration key ApiAllowedIPs") return nil
} }
// If wildcard declared in config: Continue // If wildcard declared in config: Continue
if config.Keys.APIAllowedIPs[0] == "*" { if config.Keys.APIAllowedIPs[0] == "*" {

View File

@@ -6,7 +6,7 @@
package config package config
var configSchema = ` var configSchema = `
{ {
"type": "object", "type": "object",
"properties": { "properties": {
"addr": { "addr": {
@@ -135,6 +135,5 @@ var configSchema = `
}, },
"required": ["subjectJobEvent", "subjectNodeState"] "required": ["subjectJobEvent", "subjectNodeState"]
} }
}, }
"required": ["apiAllowedIPs"] }`
}`