def create_app(): from .blueprints.events import setup_case_stream connexion_app = connexion.App(__name__, specification_dir='api/') _app = connexion_app.app compose_yamls() _app.jinja_loader = FileSystemLoader(['server/templates']) _app.config.update( # CHANGE SECRET KEY AND SECURITY PASSWORD SALT!!! SECRET_KEY="SHORTSTOPKEYTEST", SQLALCHEMY_DATABASE_URI=format_db_path( core.config.config.walkoff_db_type, os.path.abspath(paths.db_path)), SECURITY_PASSWORD_HASH='pbkdf2_sha512', SECURITY_TRACKABLE=False, SECURITY_PASSWORD_SALT='something_super_secret_change_in_production', SECURITY_POST_LOGIN_VIEW='/', WTF_CSRF_ENABLED=False, STATIC_FOLDER=os.path.abspath('server/static')) _app.config["SECURITY_LOGIN_USER_TEMPLATE"] = "login_user.html" _app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False connexion_app.add_api('composed_api.yaml') register_blueprints(_app) core.config.config.initialize() setup_case_stream() monkey.patch_all() return _app
def create_app(): import core.config connexion_app = connexion.App(__name__, specification_dir='api/') _app = connexion_app.app _app.jinja_loader = FileSystemLoader(['server/templates']) _app.config.update( # CHANGE SECRET KEY AND SECURITY PASSWORD SALT!!! SECRET_KEY=core.config.config.secret_key, SQLALCHEMY_DATABASE_URI=format_db_path( core.config.config.walkoff_db_type, os.path.abspath(paths.db_path)), SECURITY_PASSWORD_HASH='pbkdf2_sha512', SECURITY_TRACKABLE=False, SECURITY_PASSWORD_SALT='something_super_secret_change_in_production', SECURITY_POST_LOGIN_VIEW='/', WTF_CSRF_ENABLED=False, JWT_BLACKLIST_ENABLED=True, JWT_BLACKLIST_TOKEN_CHECKS=['refresh'], JWT_TOKEN_LOCATION='headers', SQLALCHEMY_TRACK_MODIFICATIONS=False) from server.database import db db.init_app(_app) from server.security import jwt jwt.init_app(_app) connexion_app.add_api('composed_api.yaml') core.config.config.initialize() register_blueprints(_app) import core.controller core.controller.controller.load_playbooks() return _app
def __init__(self): self.engine = create_engine( format_db_path(core.config.config.case_db_type, case_db_path)) self.connection = self.engine.connect() self.transaction = self.connection.begin() Session = sessionmaker() Session.configure(bind=self.engine) self.session = scoped_session(Session) Case_Base.metadata.bind = self.engine Case_Base.metadata.create_all(self.engine)
def create(self): """ Creates the database """ self.engine = create_engine( format_db_path(core.config.config.case_db_type, case_db_path)) self.connection = self.engine.connect() self.transaction = self.connection.begin() Session = sessionmaker() Session.configure(bind=self.engine) self.session = scoped_session(Session) _Base.metadata.bind = self.engine _Base.metadata.create_all(self.engine)