You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
applyCmd.PersistentFlags().StringSliceVarP(&applyEnvironments, "env", "e", []string{}, "environments to set up (staging, production) - specify multiple times for multiple")
12
19
13
20
rootCmd.AddCommand(applyCmd)
14
21
}
@@ -18,5 +25,45 @@ var applyCmd = &cobra.Command{
18
25
Short: "Execute modules to create projects, infrastructure, etc.",
19
26
Run: func(cmd*cobra.Command, args []string) {
20
27
28
+
iflen(applyEnvironments) ==0 {
29
+
fmt.Println(`Choose the environments to apply. This will create infrastructure, CI pipelines, etc.
30
+
At this point, real things will be generated that may cost money!
31
+
Only a single environment may be suitable for an initial test, but for a real system we suggest setting up both staging and production environments.`)
32
+
applyEnvironments=promptEnvironments()
33
+
}
34
+
35
+
// Strict for now, we can brainstorm how much we want to support custom environments later
36
+
for_, env:=rangeapplyEnvironments {
37
+
ifenv!="staging"&&env!="production" {
38
+
exit.Fatal("The currently supported environments are \"staging\" and \"production\"")
39
+
}
40
+
}
41
+
42
+
// @TODO : Pass environments to make commands
21
43
},
22
44
}
45
+
46
+
// promptEnvironments Prompts the user for the environments to apply against and returns a slice of strings representing the environments
47
+
funcpromptEnvironments() []string {
48
+
items:=map[string][]string{
49
+
"Staging ": []string{"staging"},
50
+
"Production": []string{"production"},
51
+
"Both Staging and Production": []string{"staging", "production"},
0 commit comments