diff options
author | Ririsoft <[email protected]> | 2024-06-08 19:34:18 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-06-08 11:34:18 -0600 |
commit | 0bc27e5fb1252716f82c2b5af56189e8b46ead3c (patch) | |
tree | e03f961b218b43070d53178136e2f4f269b522c3 /modules/logging/filewriter.go | |
parent | 9be4f194e036dddd4704a851fd15a9682d9e813d (diff) | |
download | caddy-0bc27e5fb1252716f82c2b5af56189e8b46ead3c.tar.gz caddy-0bc27e5fb1252716f82c2b5af56189e8b46ead3c.zip |
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.
Diffstat (limited to 'modules/logging/filewriter.go')
-rw-r--r-- | modules/logging/filewriter.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/modules/logging/filewriter.go b/modules/logging/filewriter.go index 393228fda..09cea1b4e 100644 --- a/modules/logging/filewriter.go +++ b/modules/logging/filewriter.go @@ -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. |