osbuild-worker: add CHANNEL to worker logs

aka "the deployment channel" like "staging" or "production"
This commit is contained in:
Florian Schüller 2024-08-21 10:24:21 +02:00 committed by Florian Schüller
parent 2519e55ccd
commit 8d24dcfbde
4 changed files with 22 additions and 0 deletions

View file

@ -7,6 +7,7 @@ import (
"errors"
"flag"
"fmt"
slogger "github.com/osbuild/osbuild-composer/pkg/splunk_logger"
"net/url"
"os"
"path"
@ -193,6 +194,10 @@ func main() {
logrus.Fatalf("Could not print config: %v", err)
}
if config.DeploymentChannel != "" {
logrus.AddHook(&slogger.EnvironmentHook{Channel: config.DeploymentChannel})
}
cacheDirectory, ok := os.LookupEnv("CACHE_DIRECTORY")
if !ok {
logrus.Fatal("CACHE_DIRECTORY is not set. Is the service file missing CacheDirectory=?")