Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

loopia: add configurable API endpoint #1704

Merged
merged 1 commit into from
Aug 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/zz_gen_cmd_dnshelp.go
Original file line number Diff line number Diff line change
Expand Up @@ -1390,6 +1390,7 @@ func displayDNSHelp(name string) error {
ew.writeln()

ew.writeln(`Additional Configuration:`)
ew.writeln(` - "LOOPIA_API_URL": API endpoint. Ex: https://api.loopia.se/RPCSERV or https://api.loopia.rs/RPCSERV`)
ew.writeln(` - "LOOPIA_HTTP_TIMEOUT": API request timeout`)
ew.writeln(` - "LOOPIA_POLLING_INTERVAL": Time between DNS propagation check`)
ew.writeln(` - "LOOPIA_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation`)
Expand Down
1 change: 1 addition & 0 deletions docs/content/dns/zz_gen_loopia.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ More information [here]({{< ref "dns#configuration-and-credentials" >}}).

| Environment Variable Name | Description |
|--------------------------------|-------------|
| `LOOPIA_API_URL` | API endpoint. Ex: https://api.loopia.se/RPCSERV or https://api.loopia.rs/RPCSERV |
| `LOOPIA_HTTP_TIMEOUT` | API request timeout |
| `LOOPIA_POLLING_INTERVAL` | Time between DNS propagation check |
| `LOOPIA_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
Expand Down
7 changes: 6 additions & 1 deletion providers/dns/loopia/loopia.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const (

EnvAPIUser = envNamespace + "API_USER"
EnvAPIPassword = envNamespace + "API_PASSWORD"
EnvAPIURL = envNamespace + "API_URL"

EnvTTL = envNamespace + "TTL"
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
Expand Down Expand Up @@ -50,7 +51,6 @@ type Config struct {
// NewDefaultConfig returns a default configuration for the DNSProvider.
func NewDefaultConfig() *Config {
return &Config{
BaseURL: internal.DefaultBaseURL,
TTL: env.GetOrDefaultInt(EnvTTL, minTTL),
PropagationTimeout: env.GetOrDefaultSecond(EnvPropagationTimeout, 40*time.Minute),
PollingInterval: env.GetOrDefaultSecond(EnvPollingInterval, 60*time.Second),
Expand Down Expand Up @@ -83,6 +83,7 @@ func NewDNSProvider() (*DNSProvider, error) {
config := NewDefaultConfig()
config.APIUser = values[EnvAPIUser]
config.APIPassword = values[EnvAPIPassword]
config.BaseURL = env.GetOrDefaultString(EnvAPIURL, internal.DefaultBaseURL)

return NewDNSProviderConfig(config)
}
Expand All @@ -108,6 +109,10 @@ func NewDNSProviderConfig(config *Config) (*DNSProvider, error) {
client.HTTPClient = config.HTTPClient
}

if config.BaseURL != "" {
client.BaseURL = config.BaseURL
}

return &DNSProvider{
config: config,
client: client,
Expand Down
1 change: 1 addition & 0 deletions providers/dns/loopia/loopia.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ It needs to have the following permissions:
LOOPIA_API_USER = "API username"
LOOPIA_API_PASSWORD = "API password"
[Configuration.Additional]
LOOPIA_API_URL = "API endpoint. Ex: https://api.loopia.se/RPCSERV or https://api.loopia.rs/RPCSERV"
LOOPIA_POLLING_INTERVAL = "Time between DNS propagation check"
LOOPIA_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation"
LOOPIA_TTL = "The TTL of the TXT record used for the DNS challenge"
Expand Down