mirror of
https://github.com/ClusterCockpit/cc-backend
synced 2026-01-16 09:41:47 +01:00
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:
@@ -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] == "*" {
|
||||||
|
|||||||
@@ -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"]
|
}`
|
||||||
}`
|
|
||||||
|
|||||||
Reference in New Issue
Block a user