2020-02-26 15:49:12 +01:00
|
|
|
import os
|
2021-02-26 23:26:32 +01:00
|
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
2020-02-26 15:49:12 +01:00
|
|
|
|
2021-08-25 18:57:38 +02:00
|
|
|
REPO_URL = os.getenv("REPO_URL")
|
2021-10-31 23:09:54 +01:00
|
|
|
REPO_BRANCH = os.getenv("REPO_BRANCH", "master")
|
2021-08-25 18:57:38 +02:00
|
|
|
NETBOX_URL = os.getenv("NETBOX_URL")
|
|
|
|
NETBOX_TOKEN = os.getenv("NETBOX_TOKEN")
|
|
|
|
IGNORE_SSL_ERRORS = (os.getenv("IGNORE_SSL_ERRORS", "False") == "True")
|
2020-02-26 15:49:12 +01:00
|
|
|
|
2021-12-16 23:26:22 +01:00
|
|
|
# optionally load vendors through a comma separated list as env var
|
|
|
|
VENDORS = list(filter(None, os.getenv("VENDORS", "").split(",")))
|
2021-05-16 14:46:09 +02:00
|
|
|
|
2021-10-05 17:02:21 +02:00
|
|
|
# optionally load device types through a space separated list as env var
|
|
|
|
SLUGS = os.getenv("SLUGS", "").split()
|
|
|
|
|
2022-09-08 18:48:24 +02:00
|
|
|
NETBOX_FEATURES = {
|
|
|
|
'modules': False,
|
|
|
|
}
|
2021-10-05 17:02:21 +02:00
|
|
|
|
2021-02-27 01:02:03 +01:00
|
|
|
MANDATORY_ENV_VARS = ["REPO_URL", "NETBOX_URL", "NETBOX_TOKEN"]
|
2020-02-26 15:49:12 +01:00
|
|
|
|
|
|
|
for var in MANDATORY_ENV_VARS:
|
|
|
|
if var not in os.environ:
|
2021-02-26 23:26:32 +01:00
|
|
|
raise EnvironmentError("Failed because {} is not set.".format(var))
|