server, service: added running as effective user

This commit is contained in:
2026-03-25 16:53:13 +02:00
parent 1f5b4a71f1
commit 5e7b1f312d
16 changed files with 361 additions and 144 deletions
+2
View File
@@ -36,6 +36,7 @@ type Config struct {
RunPath string `json:"runfile" yaml:"runfile"`
AsDaemon bool `json:"asDaemon" yaml:"asDaemon"`
LogLimit int64 `json:"logLimit" yaml:logLimit`
RunUser string `json:"runUser" yaml:runUser`
}
func NewConfig() (*Config, error) {
@@ -45,6 +46,7 @@ func NewConfig() (*Config, error) {
},
AsDaemon: false,
LogLimit: 1024 * 1024 * 10, // 10 Mb
RunUser: "daemon",
}
hostname, err := os.Hostname()
if err != nil {
+6 -5
View File
@@ -1,9 +1,10 @@
package config
const (
confdirPath = "/home/ziggi/Projects/minilb/etc/minilb"
rundirPath = "/home/ziggi/Projects/minilb/tmp/run"
logdirPath = "/home/ziggi/Projects/minilb/tmp/log"
datadirPath = "/home/ziggi/Projects/minilb/tmp/data"
packageVersion = "0.0.1"
confdirPath = "/etc/minilb"
rundirPath = "/var/run/minilb"
logdirPath = "/var/log/minilb"
datadirPath = "/var/lib/minilb"
pkgVersion = "0.0.1"
runUser = "daemon"
)
+6 -6
View File
@@ -1,10 +1,10 @@
package config
const (
confdirPath = "@srv_confdir@"
rundirPath = "@srv_rundir@"
logdirPath = "@srv_logdir@"
datadirPath = "@srv_datadir@"
packageVersion = "@PACKAGE_VERSION@"
confdirPath = "@srv_confdir@"
rundirPath = "@srv_rundir@"
logdirPath = "@srv_logdir@"
datadirPath = "@srv_datadir@"
pkgVersion = "@PACKAGE_VERSION@"
runUser = "@run_user@"
)