Add endpoint-bound Verizon DNS adapter
This commit is contained in:
@@ -6,6 +6,7 @@ import time
|
||||
import requests
|
||||
import urllib3
|
||||
|
||||
from ...adapters import Endpoint
|
||||
from ...models import ProviderCapabilities, ProviderRecord
|
||||
from ...normalizer import normalize_hostname, normalize_ipv4
|
||||
|
||||
@@ -36,9 +37,26 @@ class Plugin:
|
||||
max_records=64,
|
||||
)
|
||||
|
||||
def __init__(self, config):
|
||||
def __init__(
|
||||
self,
|
||||
config,
|
||||
endpoint: Endpoint | None = None,
|
||||
):
|
||||
self.config = config
|
||||
self.router_url = os.getenv("ROUTER_URL", "https://192.168.1.1").rstrip("/")
|
||||
self.endpoint = endpoint
|
||||
|
||||
if endpoint is None:
|
||||
self.router_url = os.getenv(
|
||||
"ROUTER_URL",
|
||||
"https://192.168.1.1",
|
||||
).rstrip("/")
|
||||
else:
|
||||
if endpoint.plugin != "verizon":
|
||||
raise RuntimeError(
|
||||
"Verizon provider requires a verizon endpoint"
|
||||
)
|
||||
self.router_url = f"https://{endpoint.address}"
|
||||
|
||||
self.password = os.getenv("ROUTER_PASSWORD")
|
||||
if not self.password:
|
||||
raise RuntimeError("ROUTER_PASSWORD is required when DNS_PROVIDER=verizon")
|
||||
|
||||
Reference in New Issue
Block a user