This repository has been archived by the owner on Apr 29, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
main.go
75 lines (63 loc) · 1.47 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
66
67
68
69
70
71
72
73
74
75
package main
import (
"fmt"
"math/rand"
"os"
"github.com/caos/orbos/internal/stores/github"
)
var (
// Build arguments
gitCommit = "none"
version = "none"
githubClientID = "none"
githubClientSecret = "none"
)
func main() {
defer func() {
if r := recover(); r != nil {
_, _ = os.Stderr.Write([]byte(fmt.Sprintf("\x1b[0;31m%v\x1b[0m\n", r)))
os.Exit(1)
}
}()
github.ClientID = githubClientID
github.ClientSecret = githubClientSecret
github.Key = RandStringBytes(32)
rootCmd, rootValues := RootCommand()
rootCmd.Version = fmt.Sprintf("%s %s\n", version, gitCommit)
takeoff := TakeoffCommand(rootValues)
takeoff.AddCommand(
StartBoom(rootValues),
StartOrbiter(rootValues),
StartZitadel(rootValues),
)
nodes := NodeCommand()
nodes.AddCommand(
ReplaceCommand(rootValues),
RebootCommand(rootValues),
ExecCommand(rootValues),
)
rootCmd.AddCommand(
ReadSecretCommand(rootValues),
WriteSecretCommand(rootValues),
EditCommand(rootValues),
TeardownCommand(rootValues),
ConfigCommand(rootValues),
APICommand(rootValues),
BackupListCommand(rootValues),
RestoreCommand(rootValues),
BackupCommand(rootValues),
takeoff,
nodes,
)
if err := rootCmd.Execute(); err != nil {
os.Exit(1)
}
}
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
func RandStringBytes(n int) string {
b := make([]byte, n)
for i := range b {
b[i] = letterBytes[rand.Intn(len(letterBytes))]
}
return string(b)
}