def load_config(path): import configparser import os defaults = { 'add_self_as_whisper_account': '1', 'trusted_mods': '0', 'deck_tab_images': '1', } config = configparser.ConfigParser(defaults=defaults) res = config.read(os.path.realpath(path)) if len(res) == 0: log.error('{0} missing. Check out install/config.example.ini'.format(path)) sys.exit(0) return config
def load_from_default_config_file(cls, debug=False): """デフォルトのコンフィグファイルを読み込む. Args: debug (bool): Debugフラグ Returns: circle_core.core.CircleCore: Core Object """ config = cls._make_config_parser() okfiles = config.read([ './{}'.format(DEFAULT_CONFIG_FILE_NAME), os.path.expanduser('~/{}'.format(DEFAULT_CONFIG_FILE_NAME)), '/etc/circle_core/{}'.format(DEFAULT_CONFIG_FILE_NAME), ]) if not okfiles: raise ConfigError('no config file found') return cls.load_from_config(config, debug=debug)
def load_config(path): import configparser import os config = configparser.ConfigParser() config.read_dict({ "main": { "trusted_mods": "0" }, "web": { "deck_tab_images": "1" } }) res = config.read(os.path.realpath(path)) if not res: log.error("%s missing. Check out the example config file.", path) sys.exit(0) return config