forked from TrueCloudLab/lego
loopia: add configuratble API endpoint (#1704)
This commit is contained in:
parent
d7b0593eb6
commit
ca18391d25
4 changed files with 9 additions and 1 deletions
|
@ -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`)
|
||||
|
|
|
@ -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 |
|
||||
|
|
|
@ -22,6 +22,7 @@ const (
|
|||
|
||||
EnvAPIUser = envNamespace + "API_USER"
|
||||
EnvAPIPassword = envNamespace + "API_PASSWORD"
|
||||
EnvAPIURL = envNamespace + "API_URL"
|
||||
|
||||
EnvTTL = envNamespace + "TTL"
|
||||
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
|
||||
|
@ -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),
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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,
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue