"""Flask and other extensions instantiated here.

To avoid circular imports with views and create_app(), extensions are instantiated here. They will be initialized
(calling init_app()) in application.py.
"""
import os
from logging import getLogger
import pritunl_dedicated as app_root
from flask_babel import Babel
from flask_navigation import Navigation
from flask_sqlalchemy import SQLAlchemy
from flask_migrate import Migrate
from flask_cors import CORS
from flask_jwt_extended import JWTManager

LOG = getLogger(__name__)
APP_ROOT_FOLDER = os.path.abspath(os.path.dirname(app_root.__file__))
MIGRATE_ROOT_FOLDER = os.path.abspath(os.path.join(APP_ROOT_FOLDER, 'migrations'))


babel = Babel()
jwt = JWTManager()
navigation = Navigation()
db = SQLAlchemy()
cors = CORS()
migrate = Migrate(directory=MIGRATE_ROOT_FOLDER)
