Implemented Env-Change
This commit is contained in:
11
main.py
11
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():
|
||||
|
||||
Reference in New Issue
Block a user