|
|
@ -4,6 +4,9 @@ from flask_jwt_extended import JWTManager, create_access_token |
|
|
|
from mongoengine import connect |
|
|
|
from mongoengine import connect |
|
|
|
from werkzeug.security import check_password_hash |
|
|
|
from werkzeug.security import check_password_hash |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
from os import environ, path |
|
|
|
|
|
|
|
from dotenv import load_dotenv |
|
|
|
|
|
|
|
|
|
|
|
from internal_lib.AuthMethots import AuthJWT |
|
|
|
from internal_lib.AuthMethots import AuthJWT |
|
|
|
from models.Group import Group |
|
|
|
from models.Group import Group |
|
|
|
from models.Union import Union |
|
|
|
from models.Union import Union |
|
|
@ -11,13 +14,24 @@ from models.User import User |
|
|
|
from restapi import MongoApi |
|
|
|
from restapi import MongoApi |
|
|
|
from flask_admin import Admin |
|
|
|
from flask_admin import Admin |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
Load .env file and get variables |
|
|
|
|
|
|
|
""" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
base_path = path.abspath(path.dirname(__file__)) |
|
|
|
|
|
|
|
load_dotenv(path.join(base_path, '.env')) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
MONGO_HOST = environ.get('MONGO_HOST') |
|
|
|
|
|
|
|
MONGO_USER = environ.get('MONGO_USER') |
|
|
|
|
|
|
|
MONGO_PASSWORD = environ.get('MONGO_PASSWORD') |
|
|
|
|
|
|
|
|
|
|
|
""" |
|
|
|
""" |
|
|
|
Mongodb connection string |
|
|
|
Mongodb connection string |
|
|
|
""" |
|
|
|
""" |
|
|
|
connect('adunatio', host='mongo', username="xcoder", password="4dun4710", authentication_source='admin') |
|
|
|
connect('adunatio', host=MONGO_HOST, username=MONGO_USER, password=MONGO_PASSWORD, authentication_source='admin') |
|
|
|
|
|
|
|
|
|
|
|
app = Flask(__name__) |
|
|
|
app = Flask(__name__) |
|
|
|
app.secret_key = "secret_key+secret_key" |
|
|
|
app.secret_key = environ.get('APP_SECRET') |
|
|
|
app.config["JWT_TOKEN_LOCATION"] = "headers" |
|
|
|
app.config["JWT_TOKEN_LOCATION"] = "headers" |
|
|
|
app.config["JWT_HEADER_NAME"] = "Adunation_Session_Token" |
|
|
|
app.config["JWT_HEADER_NAME"] = "Adunation_Session_Token" |
|
|
|
app.config["JWT_HEADER_TYPE"] = "Bearer" |
|
|
|
app.config["JWT_HEADER_TYPE"] = "Bearer" |
|
|
|