bluecat: skip deploy (#2230)
This commit is contained in:
parent
04864ff13b
commit
9873b9b897
4 changed files with 17 additions and 7 deletions
|
@ -372,6 +372,7 @@ func displayDNSHelp(w io.Writer, name string) error {
|
||||||
ew.writeln(` - "BLUECAT_HTTP_TIMEOUT": API request timeout`)
|
ew.writeln(` - "BLUECAT_HTTP_TIMEOUT": API request timeout`)
|
||||||
ew.writeln(` - "BLUECAT_POLLING_INTERVAL": Time between DNS propagation check`)
|
ew.writeln(` - "BLUECAT_POLLING_INTERVAL": Time between DNS propagation check`)
|
||||||
ew.writeln(` - "BLUECAT_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation`)
|
ew.writeln(` - "BLUECAT_PROPAGATION_TIMEOUT": Maximum waiting time for DNS propagation`)
|
||||||
|
ew.writeln(` - "BLUECAT_SKIP_DEPLOY": Skip deployements`)
|
||||||
ew.writeln(` - "BLUECAT_TTL": The TTL of the TXT record used for the DNS challenge`)
|
ew.writeln(` - "BLUECAT_TTL": The TTL of the TXT record used for the DNS challenge`)
|
||||||
|
|
||||||
ew.writeln()
|
ew.writeln()
|
||||||
|
|
|
@ -59,6 +59,7 @@ More information [here]({{< ref "dns#configuration-and-credentials" >}}).
|
||||||
| `BLUECAT_HTTP_TIMEOUT` | API request timeout |
|
| `BLUECAT_HTTP_TIMEOUT` | API request timeout |
|
||||||
| `BLUECAT_POLLING_INTERVAL` | Time between DNS propagation check |
|
| `BLUECAT_POLLING_INTERVAL` | Time between DNS propagation check |
|
||||||
| `BLUECAT_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
|
| `BLUECAT_PROPAGATION_TIMEOUT` | Maximum waiting time for DNS propagation |
|
||||||
|
| `BLUECAT_SKIP_DEPLOY` | Skip deployements |
|
||||||
| `BLUECAT_TTL` | The TTL of the TXT record used for the DNS challenge |
|
| `BLUECAT_TTL` | The TTL of the TXT record used for the DNS challenge |
|
||||||
|
|
||||||
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
The environment variable names can be suffixed by `_FILE` to reference a file instead of a value.
|
||||||
|
|
|
@ -24,6 +24,7 @@ const (
|
||||||
EnvConfigName = envNamespace + "CONFIG_NAME"
|
EnvConfigName = envNamespace + "CONFIG_NAME"
|
||||||
EnvDNSView = envNamespace + "DNS_VIEW"
|
EnvDNSView = envNamespace + "DNS_VIEW"
|
||||||
EnvDebug = envNamespace + "DEBUG"
|
EnvDebug = envNamespace + "DEBUG"
|
||||||
|
EnvSkipDeploy = envNamespace + "SKIP_DEPLOY"
|
||||||
|
|
||||||
EnvTTL = envNamespace + "TTL"
|
EnvTTL = envNamespace + "TTL"
|
||||||
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
|
EnvPropagationTimeout = envNamespace + "PROPAGATION_TIMEOUT"
|
||||||
|
@ -43,6 +44,7 @@ type Config struct {
|
||||||
TTL int
|
TTL int
|
||||||
HTTPClient *http.Client
|
HTTPClient *http.Client
|
||||||
Debug bool
|
Debug bool
|
||||||
|
SkipDeploy bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDefaultConfig returns a default configuration for the DNSProvider.
|
// NewDefaultConfig returns a default configuration for the DNSProvider.
|
||||||
|
@ -55,6 +57,7 @@ func NewDefaultConfig() *Config {
|
||||||
Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 30*time.Second),
|
Timeout: env.GetOrDefaultSecond(EnvHTTPTimeout, 30*time.Second),
|
||||||
},
|
},
|
||||||
Debug: env.GetOrDefaultBool(EnvDebug, false),
|
Debug: env.GetOrDefaultBool(EnvDebug, false),
|
||||||
|
SkipDeploy: env.GetOrDefaultBool(EnvSkipDeploy, false),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,10 +146,12 @@ func (d *DNSProvider) Present(domain, token, keyAuth string) error {
|
||||||
return fmt.Errorf("bluecat: add TXT record: %w", err)
|
return fmt.Errorf("bluecat: add TXT record: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !d.config.SkipDeploy {
|
||||||
err = d.client.Deploy(ctx, parentZoneID)
|
err = d.client.Deploy(ctx, parentZoneID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("bluecat: deploy: %w", err)
|
return fmt.Errorf("bluecat: deploy: %w", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = d.client.Logout(ctx)
|
err = d.client.Logout(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -185,10 +190,12 @@ func (d *DNSProvider) CleanUp(domain, token, keyAuth string) error {
|
||||||
return fmt.Errorf("bluecat: delete TXT record: %w", err)
|
return fmt.Errorf("bluecat: delete TXT record: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !d.config.SkipDeploy {
|
||||||
err = d.client.Deploy(ctx, parentZoneID)
|
err = d.client.Deploy(ctx, parentZoneID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("bluecat: deploy: %w", err)
|
return fmt.Errorf("bluecat: deploy: %w", err)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
err = d.client.Logout(ctx)
|
err = d.client.Logout(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -26,6 +26,7 @@ lego --email you@example.com --dns bluecat --domains my.example.org run
|
||||||
BLUECAT_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation"
|
BLUECAT_PROPAGATION_TIMEOUT = "Maximum waiting time for DNS propagation"
|
||||||
BLUECAT_TTL = "The TTL of the TXT record used for the DNS challenge"
|
BLUECAT_TTL = "The TTL of the TXT record used for the DNS challenge"
|
||||||
BLUECAT_HTTP_TIMEOUT = "API request timeout"
|
BLUECAT_HTTP_TIMEOUT = "API request timeout"
|
||||||
|
BLUECAT_SKIP_DEPLOY = "Skip deployements"
|
||||||
|
|
||||||
[Links]
|
[Links]
|
||||||
API = "https://docs.bluecatnetworks.com/r/Address-Manager-API-Guide/REST-API/9.1.0"
|
API = "https://docs.bluecatnetworks.com/r/Address-Manager-API-Guide/REST-API/9.1.0"
|
||||||
|
|
Loading…
Reference in a new issue