tangled
alpha
login
or
join now
aottr.dev
/
nox
0
fork
atom
this repo has no description
0
fork
atom
overview
issues
pulls
pipelines
add cli
Alex Ottr
9 months ago
eb483bcb
e20d51d5
+62
-1
2 changed files
expand all
collapse all
unified
split
.gitignore
cmd
nox
main.go
+2
-1
.gitignore
···
45
45
nox
46
46
keys
47
47
secrets
48
48
-
.nox-state.json
48
48
+
.nox-state.json
49
49
+
!cmd/nox
+60
cmd/nox/main.go
···
1
1
+
package main
2
2
+
3
3
+
import (
4
4
+
"log"
5
5
+
"os"
6
6
+
"context"
7
7
+
8
8
+
"github.com/aottr/nox/internal/config"
9
9
+
"github.com/aottr/nox/internal/constants"
10
10
+
"github.com/aottr/nox/internal/process"
11
11
+
"github.com/urfave/cli/v3"
12
12
+
)
13
13
+
14
14
+
func main() {
15
15
+
16
16
+
var configPath string
17
17
+
18
18
+
cmd := &cli.Command{
19
19
+
Name: "nox",
20
20
+
Usage: "Manage and decrypt app secrets",
21
21
+
Flags: []cli.Flag{
22
22
+
&cli.StringFlag{
23
23
+
Name: "config",
24
24
+
Value: constants.DefaultConfigPath,
25
25
+
Usage: "path to config file",
26
26
+
Destination: &configPath,
27
27
+
},
28
28
+
},
29
29
+
Commands: []*cli.Command{
30
30
+
{
31
31
+
Name: "run",
32
32
+
Aliases: []string{"r"},
33
33
+
Usage: "Fetch, decrypt, and process app secrets",
34
34
+
Action: func(ctx context.Context, cmd *cli.Command) error {
35
35
+
cfg, err := config.Load(configPath)
36
36
+
if err != nil {
37
37
+
log.Fatalf("failed to load config: %v", err)
38
38
+
}
39
39
+
return process.ProcessApps(cfg)
40
40
+
},
41
41
+
},
42
42
+
{
43
43
+
Name: "validate",
44
44
+
Aliases: []string{"v"},
45
45
+
Usage: "Validate configuration and secret integrity",
46
46
+
Action: func(ctx context.Context, cmd *cli.Command) error {
47
47
+
cfg, err := config.Load(configPath)
48
48
+
if err != nil {
49
49
+
log.Fatalf("failed to load config: %v", err)
50
50
+
}
51
51
+
return process.Validate(cfg)
52
52
+
},
53
53
+
},
54
54
+
},
55
55
+
}
56
56
+
57
57
+
if err := cmd.Run(context.Background(), os.Args); err != nil {
58
58
+
log.Fatal(err)
59
59
+
}
60
60
+
}