Skip to content

Commit 27d445b

Browse files
authored
Merge pull request #257 from hectordufau/main
Adding FIREFLY_HOME env variable (optional)
2 parents 5a636c1 + 61e1b82 commit 27d445b

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

cmd/root.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ would otherwise be a time consuming manual task. It also wraps docker compose
6262
commands to manage the lifecycle of stacks.
6363
6464
To get started run: ff init
65+
Optional: Set FIREFLY_HOME env variable for FireFly stack configuration path.
6566
`,
6667
PersistentPreRun: func(cmd *cobra.Command, args []string) {
6768
if ansi == "always" {

internal/constants/constants.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,17 @@ import (
2121
"path/filepath"
2222
)
2323

24-
var homeDir, _ = os.UserHomeDir()
25-
var StacksDir = filepath.Join(homeDir, ".firefly", "stacks")
26-
24+
var StacksDir = checkHome()
2725
var FireFlyCoreImageName = "ghcr.io/hyperledger/firefly"
2826
var IPFSImageName = "ipfs/go-ipfs:v0.10.0"
2927
var PostgresImageName = "postgres"
3028
var PrometheusImageName = "prom/prometheus"
3129
var SandboxImageName = "ghcr.io/hyperledger/firefly-sandbox:latest"
30+
31+
func checkHome() string {
32+
var homeDir, _ = os.UserHomeDir()
33+
var StacksDir = filepath.Join(homeDir, ".firefly", "stacks")
34+
var fireflyhome, present = os.LookupEnv("FIREFLY_HOME")
35+
if present { StacksDir = filepath.Join(fireflyhome, "stacks") }
36+
return StacksDir
37+
}

0 commit comments

Comments
 (0)