2024-04-03 09:05:12 +00:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"reCoreD-UI/controllers"
|
2024-04-09 08:28:18 +00:00
|
|
|
"reCoreD-UI/database"
|
2024-04-03 09:05:12 +00:00
|
|
|
|
|
|
|
"github.com/urfave/cli/v2"
|
2024-04-10 05:24:01 +00:00
|
|
|
"github.com/urfave/cli/v2/altsrc"
|
2024-04-03 09:05:12 +00:00
|
|
|
)
|
|
|
|
|
2024-04-10 05:24:01 +00:00
|
|
|
var DNSCommand = &cli.Command{
|
|
|
|
Name: "dns",
|
|
|
|
Usage: "Config DNS Settings",
|
|
|
|
Flags: []cli.Flag{
|
|
|
|
altsrc.NewStringSliceFlag(&cli.StringSliceFlag{
|
|
|
|
Name: "servers",
|
|
|
|
Usage: "dns servers",
|
|
|
|
Aliases: []string{"s"},
|
|
|
|
Required: true,
|
|
|
|
}),
|
|
|
|
},
|
|
|
|
Action: setDNS,
|
2024-04-03 09:05:12 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func setDNS(c *cli.Context) error {
|
2024-04-09 08:28:18 +00:00
|
|
|
if err := database.Connect(c.String("mysql-dsn")); err != nil {
|
2024-04-03 09:05:12 +00:00
|
|
|
return err
|
|
|
|
}
|
2024-04-11 03:41:33 +00:00
|
|
|
if c.Bool("debug") {
|
|
|
|
database.Client = database.Client.Debug()
|
|
|
|
}
|
2024-04-09 08:28:18 +00:00
|
|
|
return controllers.SetupDNS(c.StringSlice("servers")...)
|
2024-04-03 09:05:12 +00:00
|
|
|
}
|