Skip to content

Commit 16c051b

Browse files
authored
make LoadEnv use SICHER_MASTER_KEY env variable
make LoadEnv use SICHER_MASTER_KEY env variable
2 parents 2ce7d10 + 4fcc531 commit 16c051b

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

cmd/main

2.56 MB
Binary file not shown.

config.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,16 @@ func (s *sicher) configure() {
1414
return
1515
}
1616
// read the encryption key
17-
key, err := os.ReadFile(fmt.Sprintf("%s%s.key", s.Path, s.Environment))
18-
if err != nil {
19-
fmt.Printf("encryption key (%s.key) is not available. Create one by running the cli with init flag.\n", s.Environment)
20-
return
17+
18+
strKey := os.Getenv(masterKey)
19+
if strKey == "" {
20+
key, err := os.ReadFile(fmt.Sprintf("%s%s.key", s.Path, s.Environment))
21+
if err != nil {
22+
fmt.Printf("encryption key (%s.key) is not available. Create one by running the cli with init flag.\n", s.Environment)
23+
return
24+
}
25+
strKey = string(key)
2126
}
22-
strKey := string(key)
2327

2428
// read the encrypted credentials file
2529
credFile, err := os.ReadFile(fmt.Sprintf("%s%s.enc", s.Path, s.Environment))

dev.enc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
27737e8dfe9f1835d42dbf06f0b0f609431c40bd951f496819d917a47a0b25b644fa78==--==a7630f58252bb75c65ccff8f
1+
468e7c2c4da109de95c301e495e45e64467c20e02f0ac5c1a8bf696c4f6d5f7a860329==--==61aa2a052eca6690271d721d

0 commit comments

Comments
 (0)