diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..e81870f --- /dev/null +++ b/Dockerfile @@ -0,0 +1,6 @@ +FROM python:3.10 +LABEL authors="jmueller" + +ADD main.py . +RUN pip install py-cord mariadb python-dotenv +CMD ["python", "./main.py"] diff --git a/main.py b/main.py index 83438f0..e3edc71 100644 --- a/main.py +++ b/main.py @@ -6,10 +6,15 @@ import mariadb import sys from discord import default_permissions -load_dotenv() # load all the variables from the env file +configfile = "config.json" +if os.path.exists(configfile): + with open('config.json') as user_file: + config = json.loads(user_file.read()) +else: + config = {"db_user": os.environ["db_user"], "db_password": os.environ["db_password"], "db_host": os.environ["db_host"], "db_pass": os.environ["db_pass"]} -with open('config.json') as user_file: - config = json.loads(user_file.read()) +if os.path.exists(".env"): + load_dotenv() def connect_db():