Skip to content

Commit

Permalink
Read a FACTOM_HOME env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Masley committed Jul 28, 2017
1 parent 5893338 commit 514f9af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions engine/factomParams.go
Expand Up @@ -2,6 +2,7 @@ package engine

import (
"flag"
"os"

"github.com/FactomProject/factomd/common/primitives"
)
Expand Down Expand Up @@ -93,6 +94,7 @@ func ParseCmdLine(args []string) *FactomParams {
factomdLocationsflag := flag.String("selfaddr", "", "comma seperated IPAddresses and DNS names of this factomd to use when creating a cert file")
memProfileRate := flag.Int("mpr", 512*1024, "Set the Memory Profile Rate to update profiling per X bytes allocated. Default 512K, set to 1 to profile everything, 0 to disable.")
exposeProfilePtr := flag.Bool("exposeprofiler", false, "Setting this exposes the profiling port to outside localhost.")
factomHomePtr := flag.String("factomhome", "", "Set the factom home directory. The .factom folder will be placed here if set, otherwise it will default to $HOME")

logportPtr := flag.String("logPort", "6060", "Port for pprof logging")
portOverridePtr := flag.Int("port", 0, "Port where we serve WSAPI; default 8088")
Expand Down Expand Up @@ -167,5 +169,9 @@ func ParseCmdLine(args []string) *FactomParams {
p.torManage = *tormanager
p.torUpload = *torUploader

if *factomHomePtr != "" {
os.Setenv("FACTOM_HOME", *factomHomePtr)
}

return p
}
5 changes: 5 additions & 0 deletions util/config.go
Expand Up @@ -320,6 +320,11 @@ func ReadConfig(filename string) *FactomdConfig {
}

func GetHomeDir() string {
factomhome := os.Getenv("FACTOM_HOME")
if factomhome != "" {
return factomhome
}

// Get the OS specific home directory via the Go standard lib.
var homeDir string
usr, err := user.Current()
Expand Down

0 comments on commit 514f9af

Please sign in to comment.