Skip to content

Commit

Permalink
fix: param naming for porkbun secret api key, #12
Browse files Browse the repository at this point in the history
  • Loading branch information
davidramiro committed Feb 11, 2024
1 parent 51e7c51 commit f05318c
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion config.sample.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apiKey = ""
enabled = false
baseUrl = "https://porkbun.com/api/json/v3"
apiKey = ""
apiSecretKey = ""
secretApiKey = ""
ttl = 1800

[cloudflare]
Expand Down
2 changes: 1 addition & 1 deletion services/factory/dns_update_service_factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func init() {
viper.Set("porkbun.enabled", true)
viper.Set("porkbun.baseurl", "https://api.foo.com/client/v4")
viper.Set("porkbun.apiKey", "foo")
viper.Set("porkbun.apiSecretKey", "bar")
viper.Set("porkbun.secretApiKey", "bar")
viper.Set("porkbun.ttl", 42)

factory, _ = NewDnsUpdateServiceFactory()
Expand Down
8 changes: 4 additions & 4 deletions services/porkbun.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ import (
type PorkbunDnsUpdateService struct {
registrarSettings
apiKey string
apiSecretKey string
secretApiKey string
client HTTPClient
}

func NewPorkbunDnsUpdateService(client HTTPClient) (*PorkbunDnsUpdateService, error) {
baseUrl := viper.GetString("porkbun.baseUrl")
ttl := viper.GetInt("porkbun.ttl")
apikey := viper.GetString("porkbun.apiKey")
apiSecretkey := viper.GetString("porkbun.apiSecretKey")
SecretApiKey := viper.GetString("porkbun.secretApiKey")

if len(baseUrl) == 0 || ttl == 0 || len(apikey) == 0 {
return nil, ErrMissingInfoForServiceInit
Expand All @@ -38,7 +38,7 @@ func NewPorkbunDnsUpdateService(client HTTPClient) (*PorkbunDnsUpdateService, er
ttl: ttl,
},
apiKey: apikey,
apiSecretKey: apiSecretkey,
secretApiKey: SecretApiKey,
client: client,
}, nil
}
Expand Down Expand Up @@ -72,7 +72,7 @@ func (p *PorkbunDnsUpdateService) UpdateRecord(request *DynDnsRequest) error {
TTL: p.ttl,
Type: "A",
ApiKey: p.apiKey,
SecretApiKey: p.apiSecretKey,
SecretApiKey: p.secretApiKey,
}

exists, err := p.queryRecordExists(request, porkbunRequest)
Expand Down
2 changes: 1 addition & 1 deletion services/porkbun_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func setupPorkbunConfig() {
viper.Set("porkbun.enabled", true)
viper.Set("porkbun.baseurl", "https://api.foo.com/client/v4")
viper.Set("porkbun.apiKey", "foo")
viper.Set("porkbun.apiSecretKey", "bar")
viper.Set("porkbun.secretApiKey", "bar")
viper.Set("porkbun.ttl", 42)
}

Expand Down

0 comments on commit f05318c

Please sign in to comment.