-
Notifications
You must be signed in to change notification settings - Fork 91
/
Copy pathremove_all.go
42 lines (35 loc) · 1 KB
/
remove_all.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
package dns
import (
"fmt"
"github.com/spf13/cobra"
"github.com/nanobox-io/nanobox/helpers"
"github.com/nanobox-io/nanobox/models"
app_dns "github.com/nanobox-io/nanobox/processors/app/dns"
"github.com/nanobox-io/nanobox/util/config"
"github.com/nanobox-io/nanobox/util/display"
)
// RemoveAllCmd ...
var RemoveAllCmd = &cobra.Command{
Use: "rm-all [local|dry-run]",
Short: "remove all dns entries",
Long: ``,
Run: removeAllFn,
Hidden: true,
}
// removeAllFn ...
func removeAllFn(ccmd *cobra.Command, args []string) {
// parse the dnss excluding the context
env, _ := models.FindEnvByID(config.EnvID())
_, location, name := helpers.Endpoint(env, args, 0)
switch location {
case "local":
app, _ := models.FindAppBySlug(config.EnvID(), name)
display.CommandErr(app_dns.RemoveAll(app))
case "production":
fmt.Printf(`
--------------------------------------------------------
Production dns aliasing is not yet implemented.
--------------------------------------------------------
`)
}
}