forked from BESTSELLER/harpocrates
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
41 lines (31 loc) · 847 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package main
import (
"fmt"
"os"
"bitbucket.org/bestsellerit/harpocrates/config"
"bitbucket.org/bestsellerit/harpocrates/files"
"bitbucket.org/bestsellerit/harpocrates/util"
)
var secretJSON string
func main() {
fmt.Println("Harpocrates has started...")
config.LoadConfig()
util.GetVaultToken()
args := os.Args[1:]
if len(args) == 0 {
fmt.Println("No secret file provided!")
os.Exit(1)
}
arg := args[0]
input := util.ReadInput(arg)
allSecrets := util.ExtractSecrets(input)
if input.Format == "json" {
files.WriteFile(input.DirPath, fmt.Sprintf("secrets.%s", input.Format), files.FormatAsJSON(allSecrets))
}
if input.Format == "env" {
files.WriteFile(input.DirPath, fmt.Sprintf("secrets.%s", input.Format), files.FormatAsENV(allSecrets))
}
// This needs to be removed, it's just for testing !
// for {
// }
}