示例#1
0
def create_config(args):
    """Creates Config object and overrides it's values from args."""
    config = Config()

    if args.config:
        # Load config file from command line option
        config.from_pyfile(args.config)
    else:
        # Load config file from environment variable
        env_config = os.environ.get('KUYRUK_CONFIG')
        if env_config:
            assert os.path.isabs(env_config)
            config.from_pyfile(env_config)

    config.from_env_vars()
    config.from_cmd_args(args)
    return config