Skip to content

Commit

Permalink
CONFMANHOME env. variable minor fix
Browse files Browse the repository at this point in the history
  • Loading branch information
capsic committed Jul 17, 2022
1 parent 06d39c2 commit 2d3e2e2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,20 @@ const DEFAULTHOME = "/opt/capsic/confman"
func main() {
// Set CONFMANHOME
defaultHome := true

// Get from env
if os.Getenv("CONFMANHOME") != "" {
defaultHome = false
}

// Get from argument
if len(os.Args[1:]) > 0 {
if os.Args[1] != "" {
os.Setenv("CONFMANHOME", os.Args[1])
defaultHome = false
}
}

if defaultHome {
os.Setenv("CONFMANHOME", DEFAULTHOME)
}
Expand Down

0 comments on commit 2d3e2e2

Please sign in to comment.