diff --git a/dislocker_auth.py b/dislocker_auth.py index 2d1453c..71d7b29 100644 --- a/dislocker_auth.py +++ b/dislocker_auth.py @@ -4,23 +4,30 @@ import json from flask import Flask, request, jsonify, render_template config_dir_path = "./config/" -db_config_path = config_dir_path + "db.json" -if not os.path.isfile(db_config_path): +server_config_path = config_dir_path + "server.json" +if not os.path.isfile(server_config_path): if not os.path.isdir(config_dir_path): os.mkdir(config_dir_path) - db_config = { - "host": "localhost", - "db": "dislocker", - "username": "user", - "password": "example_pass", - "port": "5432" + server_config = { + "db": { + "host": "localhost", + "port": "5432", + "db_name": "dislocker", + "username": "user", + "password": "password" + }, + "bot": { + "token": "TYPE HERE BOTS TOKEN KEY", + "log_channel_id" : "TYPE HERE CHANNEL ID (YOU MUST USE INT !!!!)", + "config_channel_id": "TYPE HERE CHANNEL ID (YOU MUST USE INT !!!!)" + } } - with open(db_config_path, "w") as w: - json.dump(db_config, w, indent=4) -elif os.path.isfile(db_config_path): - with open(db_config_path, "r") as r: - db_config = json.load(r) + with open(server_config_path, "w") as w: + json.dump(server_config, w, indent=4) +elif os.path.isfile(server_config_path): + with open(server_config_path, "r") as r: + server_config = json.load(r) class Auth(): def __init__(self, host, db, port, user, password): @@ -42,7 +49,7 @@ class Auth(): app = Flask(__name__, static_folder="./resource/") -auth = Auth(db_config["host"], db_config["db"], db_config["port"], db_config["username"], db_config["password"]) +auth = Auth(server_config["db"]["host"], server_config["db"]["db_name"], server_config["db"]["port"], server_config["db"]["username"], server_config["db"]["password"]) @app.route('/verify', methods=['POST']) def verify():