-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
65 lines (56 loc) · 1.56 KB
/
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"fmt"
"os"
"github.com/gumi-tsd/secret-env-manager/cmd"
"github.com/urfave/cli/v2"
)
func main() {
app := &cli.App{}
app.Name = "secret-env-manager"
app.Usage = "manage secret environment variables"
fileFlags := &cli.StringFlag{
Name: "file",
Aliases: []string{"f"},
Usage: "Load configuration from the specified format file. Available formats are Plain and Toml, and the default is Plain.",
}
exportFlags := &cli.BoolFlag{
Name: "with-export",
Aliases: []string{"e"},
Usage: "When this option is enabled, 'export' is added when displaying to standard output.",
}
quoteFlags := &cli.BoolFlag{
Name: "with-quote",
Aliases: []string{"q"},
Usage: "When this option is enabled, single quotes are added to the cached environment variable values. It is generally recommended to use this option when the value contains spaces.",
}
app.Commands = []*cli.Command{
{
Name: "init",
Usage: fmt.Sprintf("Save the credentials stored in googlecloud Secret Manager as file."),
Action: cmd.Init,
Flags: []cli.Flag{
fileFlags,
},
},
{
Name: "load",
Usage: fmt.Sprintf("Output a string to read credentials from SecretManager based on the file and export them as environment variables."),
Action: cmd.Load,
Flags: []cli.Flag{
fileFlags,
exportFlags,
},
},
{
Name: "update",
Usage: fmt.Sprintf("Forcefully update the cached information for the load command."),
Action: cmd.Update,
Flags: []cli.Flag{
fileFlags,
quoteFlags,
},
},
}
app.Run(os.Args)
}