Skip to content

Commit

Permalink
Ⓜ️ Add only flag to sync one domain
Browse files Browse the repository at this point in the history
  • Loading branch information
jsnjack committed Oct 22, 2023
1 parent 2621f9b commit 6df39af
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/cmd_dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,14 @@ var dnsSyncCmd = &cobra.Command{
return err
}

only, err := cmd.Flags().GetString("only")
if err != nil {
return err
}
if only != "" {
logger.Printf("syncing only %s domain", only)
}

config, err := getConfig(configFile)
if err != nil {
return err
Expand All @@ -160,6 +168,9 @@ var dnsSyncCmd = &cobra.Command{
}

for domainName := range config.DNS {
if only != "" && only != domainName {
continue
}
var domainID int

for _, domain := range domains {
Expand Down Expand Up @@ -219,4 +230,5 @@ func init() {
dnsSyncCmd.PersistentFlags().StringP("config", "c", "", "configuration file, filepath")
dnsSyncCmd.PersistentFlags().Bool("doit", false, "apply planned changes")
dnsSyncCmd.PersistentFlags().Bool("remove", false, "remove resources which are not present in configuration file")
dnsSyncCmd.PersistentFlags().String("only", "", "execute sync command only for specified domain name")
}

0 comments on commit 6df39af

Please sign in to comment.