-
Notifications
You must be signed in to change notification settings - Fork 2
/
environment.py
29 lines (25 loc) · 1.59 KB
/
environment.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import os
from dotenv import load_dotenv
load_dotenv()
def check_analyse_env():
if ((os.getenv('LOCAL_IP') is None or os.getenv('LOCAL_IP') == "")
and (os.getenv('LOCAL_IPV6') is None or os.getenv('LOCAL_IPV6') == "")):
raise Exception(
'\n\nPlease complete the following environment variables in the .env file:\nLOCAL_IP\n')
# Check if we have all the environment variables for the sniffer
def check_sniffer_env():
if (((os.getenv('LISTENED_IP') is None or os.getenv('LISTENED_IP') == "")
and (os.getenv('LISTENED_IPV6') is None or os.getenv('LISTENED_IPV6') == ""))
or ((os.getenv('LOCAL_IP') is None or os.getenv('LOCAL_IP') == "")
and (os.getenv('LOCAL_IPV6') is None or os.getenv('LOCAL_IPV6') == ""))
or os.getenv('INTERFACE') is None or os.getenv('INTERFACE') == ""):
raise Exception(
'\n\nPlease complete the following environment variables in the .env file:\nLISTENED_IP\nLOCAL_IP\nINTERFACE\n')
# Check if we have all the environment variables for mongoDB
def check_mongo_env():
if (os.getenv('MONGO_CLUSTER_ADDRESS') is None or os.getenv('MONGO_CLUSTER_ADDRESS') == ""
or os.getenv('MONGO_DB_NAME') is None or os.getenv('MONGO_DB_NAME') == ""
or os.getenv('MONGO_DB_USER') is None or os.getenv('MONGO_DB_USER') == ""
or os.getenv('MONGO_DB_PASSWORD') is None or os.getenv('MONGO_DB_PASSWORD') == ""):
raise Exception(
'\n\nPlease complete the following environment variables in the .env file:\nMONGO_CLUSTER_ADDRESS\nMONGO_DB_NAME\nMONGO_DB_USER\nMONGO_DB_PASSWORD\n')