Skip to content

Commit

Permalink
Allow for DNSimple User API tokens to be used by implementing the DNS…
Browse files Browse the repository at this point in the history
…IMPLE_ACCOUNT_ID and DNSIMPLE_ZONES environment variables

Refactor the BuildDnsimpleProvider method so that the dnsimpleAccountId variable, which was only used once, can be removed
  • Loading branch information
IntegralProgrammer committed Mar 15, 2024
1 parent 3eb852f commit 487501d
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions provider/dnsimple/dnsimple.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ func NewDnsimpleProvider(domainFilter endpoint.DomainFilter, zoneIDFilter provid
// therefore this method, and not NewDnsimpleProvider, must be the one used by dnsimple_test.go
func BuildDnsimpleProvider(domainFilter endpoint.DomainFilter, zoneIDFilter provider.ZoneIDFilter, dryRun bool) (*dnsimpleProvider, error) {
oauthToken := os.Getenv("DNSIMPLE_OAUTH")
dnsimpleAccountId := os.Getenv("DNSIMPLE_ACCOUNT_ID")
if len(oauthToken) == 0 {
return nil, fmt.Errorf("no dnsimple oauth token provided")
}
Expand All @@ -125,7 +124,7 @@ func BuildDnsimpleProvider(domainFilter endpoint.DomainFilter, zoneIDFilter prov
dryRun: dryRun,
}

provider.accountID = dnsimpleAccountId
provider.accountID = os.Getenv("DNSIMPLE_ACCOUNT_ID")
if provider.accountID == "" {
whoamiResponse, err := provider.identity.Whoami(context.Background())
if err != nil {
Expand Down

0 comments on commit 487501d

Please sign in to comment.