mirror of
https://github.com/caddyserver/caddy.git
synced 2026-01-17 01:30:34 +00:00
logging: fix file mode configuration parsing (#6383)
Commit 101d3e7 introduced file mode setting,
but was missing a JSON Marshaller so that
CaddyFile can be converted to JSON safely.
This commit is contained in:
@@ -59,6 +59,11 @@ func (m *fileMode) UnmarshalJSON(b []byte) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// MarshalJSON satisfies json.Marshaler.
|
||||
func (m *fileMode) MarshalJSON() ([]byte, error) {
|
||||
return []byte(fmt.Sprintf("\"%04o\"", *m)), nil
|
||||
}
|
||||
|
||||
// parseFileMode parses a file mode string,
|
||||
// adding support for `chmod` unix command like
|
||||
// 1 to 4 digital octal values.
|
||||
|
||||
Reference in New Issue
Block a user