Add an "enabled" parameter under "readonly", and make it as if the mutable handlers don't exist when read-only mode is enabled
Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
This commit is contained in:
parent
df9758ba39
commit
cbf83ecd31
7 changed files with 40 additions and 45 deletions
|
@ -109,9 +109,15 @@ func NewApp(ctx context.Context, configuration *configuration.Configuration) *Ap
|
|||
}
|
||||
}
|
||||
if v, ok := mc["readonly"]; ok {
|
||||
app.readOnly, ok = v.(bool)
|
||||
readOnly, ok := v.(map[interface{}]interface{})
|
||||
if !ok {
|
||||
panic("readonly config key must have a boolean value")
|
||||
panic("readonly config key must contain additional keys")
|
||||
}
|
||||
if readOnlyEnabled, ok := readOnly["enabled"]; ok {
|
||||
app.readOnly, ok = readOnlyEnabled.(bool)
|
||||
if !ok {
|
||||
panic("readonly's enabled config key must have a boolean value")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue