feat(net): customize socket file permission

pull/1561/head
HFO4 2 years ago
parent 50a3917a65
commit f02b6f0286

@ -1 +1 @@
Subproject commit 00d3552a762a87df53687f069e0b5856a5cff39d
Subproject commit 2bf915a33d58fc78c9c13ffc64685219c28a4732

@ -118,8 +118,21 @@ func RunUnix(server *http.Server) error {
if err != nil {
return err
}
defer listener.Close()
defer os.Remove(conf.UnixConfig.Listen)
if conf.UnixConfig.Perm > 0 {
err = os.Chmod(conf.UnixConfig.Listen, os.FileMode(conf.UnixConfig.Perm))
if err != nil {
util.Log().Warning(
"Failed to set permission to %q for socket file %q: %s",
conf.UnixConfig.Perm,
conf.UnixConfig.Listen,
err,
)
}
}
return server.Serve(listener)
}

@ -38,6 +38,7 @@ type ssl struct {
type unix struct {
Listen string
ProxyHeader string `validate:"required_with=Listen"`
Perm uint32
}
// slave 作为slave存储端配置

Loading…
Cancel
Save