Skip to content

Commit

Permalink
Support get default value for proc via env
Browse files Browse the repository at this point in the history
Signed-off-by: Viet Anh Duong <anh.duong@kyber.network>
  • Loading branch information
vietanhduong committed Dec 30, 2023
1 parent bdb312b commit 7b83058
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pkg/proc/proc.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,14 @@ import (
"github.com/sirupsen/logrus"
"github.com/vietanhduong/wbpf/pkg/logging"
"github.com/vietanhduong/wbpf/pkg/logging/logfields"
"github.com/vietanhduong/wbpf/pkg/utils"
)

var log = logging.DefaultLogger.WithFields(logrus.Fields{logfields.LogSubsys: "proc"})

var (
procPath = flag.String("proc-path", "/proc", "Path to proc directory")
hostPath = flag.String("host-path", "/", "The host directory. Useful in container.")
procPath = flag.String("proc-path", utils.GetEnvOrDefault("PROC_PATH", "/proc"), "Path to proc directory")

Check failure on line 17 in pkg/proc/proc.go

View workflow job for this annotation

GitHub Actions / Test

undefined: utils.GetEnvOrDefault

Check failure on line 17 in pkg/proc/proc.go

View workflow job for this annotation

GitHub Actions / Test

undefined: utils.GetEnvOrDefault
hostPath = flag.String("host-path", utils.GetEnvOrDefault("HOST_PATH", "/"), "The host directory. Useful in container.")

Check failure on line 18 in pkg/proc/proc.go

View workflow job for this annotation

GitHub Actions / Test

undefined: utils.GetEnvOrDefault (compile)

Check failure on line 18 in pkg/proc/proc.go

View workflow job for this annotation

GitHub Actions / Test

undefined: utils.GetEnvOrDefault (compile)
)

func ProcPath(paths ...string) string {
Expand Down

0 comments on commit 7b83058

Please sign in to comment.