def test_show_default(capsys): with open(str(paths.default_config_file_path()), 'r') as file: config_to_be_shown = file.read() run_app('config show -dc') assert config_to_be_shown in capsys.readouterr().out
def test_default_config(): cfgfile.load(paths.default_config_file_path()) assert cfg.log_enabled assert cfg.log_stdout_level == 'warn' assert cfg.log_file_level == 'info' assert cfg.log_file_path is None assert cfg.persistence_enabled assert cfg.plugins == ()
def run_config(args): if args.config_action == cli.ACTION_CONFIG_SHOW: if getattr(args, 'def_config', False): util.print_file(paths.default_config_file_path()) else: util.print_file(taro.paths.lookup_file_in_config_path(paths.CONFIG_FILE)) elif args.config_action == cli.ACTION_CONFIG_CREATE: cfgfile.copy_default_file_to_search_path(args.overwrite)
def init_server(args): config_vars = util.split_params(args.set) if args.set else {} # TODO Config variables and override values if getattr(args, 'config', None): cfgfile.load(args.config) elif getattr(args, 'def_config', False): cfgfile.load(paths.default_config_file_path()) else: cfgfile.load() taro.load_defaults() # TODO support for custom taro config
def copy_default_file_to_search_path(overwrite: bool): cfg_to_copy = paths.default_config_file_path() # Copy to first dir in search path copy_to = paths.config_file_search_path(exclude_cwd=True)[0] / paths.CONFIG_FILE util.copy_resource(cfg_to_copy, copy_to, overwrite)