# Path: app/app.py
# def create_app(environment, port):
#     flask = Flask(__name__)
#     flask.config.from_pyfile('config.py')
# 
#     config_loader = ConfigLoader(verify=False)
#     info = config_loader.load_application_info("./")
#     config = config_loader.load_config("resources/", environment)
# 
#     view_util.navigation_bar = navigation_bar
#     view_util.app_name = info['name']
# 
#     status.blueprint.navigation_bar = navigation_bar
#     status.blueprint.info = info
#     status.blueprint.environment = environment
#     status.blueprint.port = port
#     status.blueprint.start_time = Delorean.now()
# 
#     mongo = MongoConnect(config)
#     state.mongo = mongo
# 
#     views.blueprint.mongo = mongo
#     views.blueprint.config = config['app']
#     api.blueprint.mongo = mongo
#     api.blueprint.config = config['app']
# 
#     flask.register_blueprint(status.blueprint)
#     flask.register_blueprint(views.blueprint)
#     flask.register_blueprint(api.blueprint)
#     return flask


import argparse
import logging
from app.app import create_app
from werkzeug.serving import WSGIRequestHandler
#!./venv/bin/python
# -*- coding: utf-8 -*-


parser = argparse.ArgumentParser(
    description='Gatekeeper is a service to install and manage gates in build pipelines.')
parser.add_argument('-p', '--port', nargs='?', default=8080,
                    help='Port: Specify port. Default is 8080')
parser.add_argument('-e', '--env', nargs='?', default="local",
                    help='Environment: Specify which config to load. Default is local.')
parser.add_argument('-w', '--workdir', nargs='?', default="./",
                    help='Workdir: Specify which working directory to use. Default is the local directory')
parser.add_argument('-g', '--greedy', action='store_true',
                    help='Greedy: Run processes once (synchron) and then start to serve.')
parser.add_argument('-v', '--verbose', nargs='?', const="DEBUG", default="WARN",
                    help='Lets you set the loglevel. Application default: WARN. Option default: DEBUG')  # without param->const. If no present->default
args = parser.parse_args()

log_level = logging.getLevelName(args.verbose)

# Path: app/app.py
# def create_app(environment, port):
#     flask = Flask(__name__)
#     flask.config.from_pyfile('config.py')
# 
#     config_loader = ConfigLoader(verify=False)
#     info = config_loader.load_application_info("./")
#     config = config_loader.load_config("resources/", environment)
# 
#     view_util.navigation_bar = navigation_bar
#     view_util.app_name = info['name']
# 
#     status.blueprint.navigation_bar = navigation_bar
#     status.blueprint.info = info
#     status.blueprint.environment = environment
#     status.blueprint.port = port
#     status.blueprint.start_time = Delorean.now()
# 
#     mongo = MongoConnect(config)
#     state.mongo = mongo
# 
#     views.blueprint.mongo = mongo
#     views.blueprint.config = config['app']
#     api.blueprint.mongo = mongo
#     api.blueprint.config = config['app']
# 
#     flask.register_blueprint(status.blueprint)
#     flask.register_blueprint(views.blueprint)
#     flask.register_blueprint(api.blueprint)
#     return flask


# Path: run.py
import argparse
import logging
from app.app import create_app
from werkzeug.serving import WSGIRequestHandler

#!./venv/bin/python
# -*- coding: utf-8 -*-


parser = argparse.ArgumentParser(
    description='Gatekeeper is a service to install and manage gates in build pipelines.')
parser.add_argument('-p', '--port', nargs='?', default=8080,
                    help='Port: Specify port. Default is 8080')
parser.add_argument('-e', '--env', nargs='?', default="local",
                    help='Environment: Specify which config to load. Default is local.')
parser.add_argument('-w', '--workdir', nargs='?', default="./",
                    help='Workdir: Specify which working directory to use. Default is the local directory')
parser.add_argument('-g', '--greedy', action='store_true',
                    help='Greedy: Run processes once (synchron) and then start to serve.')
parser.add_argument('-v', '--verbose', nargs='?', const="DEBUG", default="WARN",
                    help='Lets you set the loglevel. Application default: WARN. Option default: DEBUG')  # without param->const. If no present->default
args = parser.parse_args()

log_level = logging.getLevelName(args.verbose)

logging.basicConfig(level=log_level,