# Path: postgraas_server/configuration.py
# def get_config(config_filename=None, secrets_file='/secrets'):
#     config_filename = config_filename or get_default_config_filename()
#     logger.debug('config filename: {}'.format(config_filename))
#     with open(config_filename, 'r') as cfg:
#         config = json.load(cfg)
#     secrets = _load_secrets(filename=secrets_file)
#     if secrets: # pragma: no cover
#         try:
#             import secure_config.secrets as sec
#             config = sec.load_secret_dict(password=secrets['encryption_key'], config_dict=config)
#         except ImportError as e:
#             logger.debug('secure_config not installed')
# 
#     return config
# 
# Path: postgraas_server/create_app.py
# def create_app(config):
#     app = Flask(__name__)
# 
#     app.config['SQLALCHEMY_DATABASE_URI'] = get_meta_db_config_path(config)
#     app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
#     app.config['BUNDLE_ERRORS'] = True
#     app_config = get_application_config(config)
# 
#     for key in app_config:
#         app.config[key.upper()] = int(app_config[key]) if key.upper() in INT_OPTIONS else app_config[key]
#     app.config['SENTRY_INCLUDE_PATHS'] = [
#         'postgraas_server',
#     ]
#     app.config['SENTRY_RELEASE'] = postgraas_server.__version__
#     sentry.init_app(app)
# 
#     restful_api = Api(app)
#     restful_api.add_resource(DBInstanceResource, "/api/v2/postgraas_instances/<int:id>")
#     restful_api.add_resource(DBInstanceCollectionResource, "/api/v2/postgraas_instances")
#     db.init_app(app)
#     app.postgraas_backend = get_backend(config)
# 
#     @app.route('/health')
#     def health():
#         return "ok"
# 
#     return app


import logging
from postgraas_server.configuration import get_config
from postgraas_server.create_app import create_app


logger = logging.getLogger(__name__)

app = create_app(get_config())

if __name__ == "__main__":

# Path: postgraas_server/configuration.py
# def get_config(config_filename=None, secrets_file='/secrets'):
#     config_filename = config_filename or get_default_config_filename()
#     logger.debug('config filename: {}'.format(config_filename))
#     with open(config_filename, 'r') as cfg:
#         config = json.load(cfg)
#     secrets = _load_secrets(filename=secrets_file)
#     if secrets: # pragma: no cover
#         try:
#             import secure_config.secrets as sec
#             config = sec.load_secret_dict(password=secrets['encryption_key'], config_dict=config)
#         except ImportError as e:
#             logger.debug('secure_config not installed')
# 
#     return config
# 
# Path: postgraas_server/create_app.py
# def create_app(config):
#     app = Flask(__name__)
# 
#     app.config['SQLALCHEMY_DATABASE_URI'] = get_meta_db_config_path(config)
#     app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False
#     app.config['BUNDLE_ERRORS'] = True
#     app_config = get_application_config(config)
# 
#     for key in app_config:
#         app.config[key.upper()] = int(app_config[key]) if key.upper() in INT_OPTIONS else app_config[key]
#     app.config['SENTRY_INCLUDE_PATHS'] = [
#         'postgraas_server',
#     ]
#     app.config['SENTRY_RELEASE'] = postgraas_server.__version__
#     sentry.init_app(app)
# 
#     restful_api = Api(app)
#     restful_api.add_resource(DBInstanceResource, "/api/v2/postgraas_instances/<int:id>")
#     restful_api.add_resource(DBInstanceCollectionResource, "/api/v2/postgraas_instances")
#     db.init_app(app)
#     app.postgraas_backend = get_backend(config)
# 
#     @app.route('/health')
#     def health():
#         return "ok"
# 
#     return app


# Path: postgraas_server/postgraas_api.py
import logging
from postgraas_server.configuration import get_config
from postgraas_server.create_app import create_app



logger = logging.getLogger(__name__)

app = create_app(get_config())

if __name__ == "__main__":

    app.run(debug=True, use_reloader=True)