Пример #1
0
def write_configuration(config_env):
    """
        Write the configuration file for the given environment
    """
    config = get_config_file_name()
    # Store existing config to <name>.backup
    if os.path.exists(config):
        shutil.move(config, "{}.backup".format(config))

    config_manager = ConfigManager(config)
    config_manager.setup_config_dir()
    config_manager.load_config(config_obj=GLOBAL_CONF[config_env])
    config_manager.write_config()
Пример #2
0
def load_configuration():
    """
        Loading configuration file
    """
    config = get_config_file_name()
    config_manager = ConfigManager(config)
    config_manager.setup_config_dir()

    if not os.path.exists(config):
        config_manager.load_config(config_obj=GLOBAL_CONF[ENVIRONMENT.DEV])
        config_manager.write_config()

    config_manager.load_config_from_file()
    return config_manager.config