diff --git a/commands/getZones.go b/commands/getZones.go index 4f3e98a1b..eb64ebc50 100644 --- a/commands/getZones.go +++ b/commands/getZones.go @@ -7,9 +7,9 @@ import ( "strings" "github.com/StackExchange/dnscontrol/v3/models" + "github.com/StackExchange/dnscontrol/v3/pkg/credsfile" "github.com/StackExchange/dnscontrol/v3/pkg/prettyzone" "github.com/StackExchange/dnscontrol/v3/providers" - "github.com/StackExchange/dnscontrol/v3/providers/config" "github.com/urfave/cli/v2" ) @@ -138,7 +138,7 @@ func GetZone(args GetZoneArgs) error { var err error // Read it in: - providerConfigs, err = config.LoadProviderConfigs(args.CredsFile) + providerConfigs, err = credsfile.LoadProviderConfigs(args.CredsFile) if err != nil { return fmt.Errorf("failed GetZone LoadProviderConfigs(%q): %w", args.CredsFile, err) } diff --git a/commands/previewPush.go b/commands/previewPush.go index 5ba7b09f6..3ef5fe461 100644 --- a/commands/previewPush.go +++ b/commands/previewPush.go @@ -8,12 +8,12 @@ import ( "github.com/urfave/cli/v2" "github.com/StackExchange/dnscontrol/v3/models" + "github.com/StackExchange/dnscontrol/v3/pkg/credsfile" "github.com/StackExchange/dnscontrol/v3/pkg/nameservers" "github.com/StackExchange/dnscontrol/v3/pkg/normalize" "github.com/StackExchange/dnscontrol/v3/pkg/notifications" "github.com/StackExchange/dnscontrol/v3/pkg/printer" "github.com/StackExchange/dnscontrol/v3/providers" - "github.com/StackExchange/dnscontrol/v3/providers/config" ) var _ = cmd(catMain, func() *cli.Command { @@ -188,7 +188,7 @@ func InitializeProviders(credsFile string, cfg *models.DNSConfig, notifyFlag boo defer func() { notify = notifications.Init(notificationCfg) }() - providerConfigs, err = config.LoadProviderConfigs(credsFile) + providerConfigs, err = credsfile.LoadProviderConfigs(credsFile) if err != nil { return } diff --git a/integrationTest/integration_test.go b/integrationTest/integration_test.go index 910924818..5de8aa85b 100644 --- a/integrationTest/integration_test.go +++ b/integrationTest/integration_test.go @@ -11,12 +11,12 @@ import ( "time" "github.com/StackExchange/dnscontrol/v3/models" + "github.com/StackExchange/dnscontrol/v3/pkg/credsfile" "github.com/StackExchange/dnscontrol/v3/pkg/nameservers" "github.com/StackExchange/dnscontrol/v3/pkg/normalize" "github.com/StackExchange/dnscontrol/v3/providers" _ "github.com/StackExchange/dnscontrol/v3/providers/_all" "github.com/StackExchange/dnscontrol/v3/providers/cloudflare" - "github.com/StackExchange/dnscontrol/v3/providers/config" "github.com/miekg/dns/dnsutil" ) @@ -37,7 +37,7 @@ func getProvider(t *testing.T) (providers.DNSServiceProvider, string, map[int]bo t.Log("No provider specified with -provider") return nil, "", nil, nil } - jsons, err := config.LoadProviderConfigs("providers.json") + jsons, err := credsfile.LoadProviderConfigs("providers.json") if err != nil { t.Fatalf("Error loading provider configs: %s", err) } diff --git a/providers/config/providerConfig.go b/pkg/credsfile/providerConfig.go similarity index 98% rename from providers/config/providerConfig.go rename to pkg/credsfile/providerConfig.go index c698740c4..1c60c2920 100644 --- a/providers/config/providerConfig.go +++ b/pkg/credsfile/providerConfig.go @@ -2,7 +2,7 @@ // It cleans nonstandard json features (comments and trailing commas), as well as replaces environment variable placeholders with // their environment variable equivalents. To reference an environment variable in your json file, simply use values in this format: // "key"="$ENV_VAR_NAME" -package config +package credsfile import ( "encoding/json" @@ -80,7 +80,7 @@ func LoadProviderConfigs(fname string) (map[string]map[string]string, error) { if len(ckeys) != 0 { fmt.Printf(`WARNING: In the future, colons in cred entry names will have meaning.`+ ` Our best advice is to remove the colons for now to avoid future compatibility issues.`+ - ` Specifically these keys: %v` + "\n", + ` Specifically these keys: %v`+"\n", quotedList(ckeys)) } return results, nil diff --git a/providers/config/providerConfig_test.go b/pkg/credsfile/providerConfig_test.go similarity index 98% rename from providers/config/providerConfig_test.go rename to pkg/credsfile/providerConfig_test.go index e32fadb75..67af7541b 100644 --- a/providers/config/providerConfig_test.go +++ b/pkg/credsfile/providerConfig_test.go @@ -1,4 +1,4 @@ -package config +package credsfile import ( "reflect"