Device-Type-Library-Import/settings.py

23 lines
721 B
Python
Raw Normal View History

2020-02-26 15:49:12 +01:00
import os
from dotenv import load_dotenv
load_dotenv()
2020-02-26 15:49:12 +01:00
REPO_URL = os.getenv("REPO_URL")
REPO_BRANCH = os.getenv("REPO_BRANCH", "master")
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-05-16 14:46:09 +02:00
# optionnally load vendors through a space separated list as env var
2021-11-24 08:16:55 +01:00
VENDORS = os.getenv("VENDORS", "").split(",")
2021-05-16 14:46:09 +02:00
# optionally load device types through a space separated list as env var
SLUGS = os.getenv("SLUGS", "").split()
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:
raise EnvironmentError("Failed because {} is not set.".format(var))