From 39971df6fac0c44e7467cc7fceeb958c59236621 Mon Sep 17 00:00:00 2001 From: "Alexander A. Klimov" Date: Wed, 15 Feb 2023 14:48:51 +0100 Subject: [PATCH] entrypoint: make /data a const for re-using --- entrypoint/main.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/entrypoint/main.go b/entrypoint/main.go index 8f77afb..19f86af 100644 --- a/entrypoint/main.go +++ b/entrypoint/main.go @@ -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