diff --git a/README.md b/README.md index 2455322..656b731 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ expects them: | `NETBOX_URL` | Base URL of the NetBox instance | | `NETBOX_BEARER` | NetBox API token (`Authorization: Bearer`) | | `NETBOX_TOKEN` | NetBox API token (`Authorization: Token`) | +| `SEARCH_VIEW` | NETBOX DNS View to search for records in. | | `DEBUG` | Optional: verbose nbapi.py logging | One of `NETBOX_BEARER` / `NETBOX_TOKEN` is required. The token's user needs @@ -42,9 +43,9 @@ wildcard, from scratch. Adapt domains, names and paths to your environment. ### 1. Create the DNS zone Create the `example.com` zone in netbox-dns, in the view the plugin searches -(`search_view` in `certbot_dns_netbox/dns_netbox.py`, default: `_default_`), and -note the numeric **zone ID** of the new zone — it is shown in the web UI URL -and can be looked up with: +(`SEARCH_VIEW` environment variable, default: `_default_`), and note the +numeric **zone ID** of the new zone — it is shown in the web UI URL and can +be looked up with: ``` GET /api/plugins/netbox-dns/zones/?name=example.com diff --git a/certbot_dns_netbox/dns_netbox.py b/certbot_dns_netbox/dns_netbox.py index 0f68400..6811295 100644 --- a/certbot_dns_netbox/dns_netbox.py +++ b/certbot_dns_netbox/dns_netbox.py @@ -26,7 +26,7 @@ from certbot.plugins import dns_common logger = logging.getLogger(__name__) # netbox-dns view that contains the zone with the challenge TXT record. -search_view = "_default_" +search_view = os.environ.get("SEARCH_VIEW") or "_default_" class Authenticator(dns_common.DNSAuthenticator):