Skip to content

Commit e94d059

Browse files
ipfabric: Add logic to fetch URL and token from environment variables. (#98)
1 parent ac621e4 commit e94d059

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

infrahub_sync/adapters/ipfabricsync.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from __future__ import annotations
22

3+
import os
34
from typing import TYPE_CHECKING, Any
45

56
try:
@@ -48,7 +49,14 @@ def _create_ipfabric_client(self, adapter: SyncAdapter) -> IPFClient:
4849
settings = adapter.settings or {}
4950

5051
base_url = settings.get("base_url", None)
52+
if not base_url:
53+
base_url = os.environ.get("IPF_URL", None)
54+
settings["base_url"] = base_url
55+
5156
auth = settings.get("auth", None)
57+
if not auth:
58+
auth = os.environ.get("IPF_TOKEN", None)
59+
settings["auth"] = auth
5260

5361
if not base_url or not auth:
5462
msg = "Both url and auth must be specified!"

0 commit comments

Comments
 (0)