Beispiel #1
0
def setup():

    global app, backend

    # initialize flask application
    app = Flask(__name__)
    Api(app)

    # load application configuration file if it exists
    config_file_path = os.environ.get('CLOUD_CONFIG_SERVICE_CONFIG_PATH')
    if config_file_path:
        with open(config_file_path) as f:
            yaml_conf = yaml.load(f.read())
            config.configure(yaml_conf)
    else:
        raise exceptions.ConfigurationError(
            'Failed loading application: '
            'CLOUD_CONFIG_SERVICE_CONFIG_PATH environment '
            'variable is not defined. Use this variable to '
            'point to the application configuration file ')

    backend = rest_backend.RestBackend(clouds=config.get().clouds)

    print('Initialized application backend: {0}'.format(backend))
Beispiel #2
0
def setup():

    global app, backend

    # initialize flask application
    app = Flask(__name__)
    Api(app)

    # load application configuration file if it exists
    config_file_path = os.environ.get('CLOUD_CONFIG_SERVICE_CONFIG_PATH')
    if config_file_path:
        with open(config_file_path) as f:
            yaml_conf = yaml.load(f.read())
            config.configure(yaml_conf)
    else:
        raise exceptions.ConfigurationError(
            'Failed loading application: '
            'CLOUD_CONFIG_SERVICE_CONFIG_PATH environment '
            'variable is not defined. Use this variable to '
            'point to the application configuration file ')

    backend = rest_backend.RestBackend(clouds=config.get().clouds)

    print('Initialized application backend: {0}'.format(backend))
Beispiel #3
0
def reset_backend():
    global app, backend
    # initialize application backend
    backend = rest_backend.RestBackend(clouds=config.get().clouds)
Beispiel #4
0
def reset_backend():
    global app, backend
    # initialize application backend
    backend = rest_backend.RestBackend(clouds=config.get().clouds)