entrypoint: make /data a const for re-using

This commit is contained in:
Alexander A. Klimov 2023-02-15 14:48:51 +01:00
parent a5db4d9f7c
commit 39971df6fa

View File

@ -18,10 +18,12 @@ import (
"time"
)
const confDir = "/data/etc/icingaweb2"
const dataVolume = "/data"
const modsDir = "/usr/share/icingaweb2/modules"
const dirMode = 0750
var confDir = path.Join(dataVolume, "etc", "icingaweb2")
var enModsDir = path.Join(confDir, "enabledModules")
func main() {
@ -38,9 +40,9 @@ func entrypoint() error {
}
if os.Getpid() == 1 {
logf("info", "Initializing /data as we're the init process")
logf("info", "Initializing %s as we're the init process", dataVolume)
for _, dir := range []string{enModsDir, "/data/var/lib/icingaweb2"} {
for _, dir := range []string{enModsDir, path.Join(dataVolume, "var", "lib", "icingaweb2")} {
logf("debug", "Creating %#v", dir)
if errMA := os.MkdirAll(dir, dirMode); errMA != nil {
return errMA