cumulate global, site and user wcs-olap.ini config file (#17474)
This commit is contained in:
parent
f03b05cba9
commit
f39ea073d5
|
@ -24,18 +24,17 @@ def main():
|
|||
|
||||
def get_config(path=None):
|
||||
config = ConfigParser.ConfigParser()
|
||||
global_config_path = '/etc/wcs_olap.ini'
|
||||
user_config_path = os.path.expanduser('~/.wcs_olap.ini')
|
||||
global_config_path = '/etc/wcs-olap/config.ini'
|
||||
user_config_path = os.path.expanduser('~/.wcs-olap.ini')
|
||||
if not path:
|
||||
if os.path.exists(user_config_path):
|
||||
path = user_config_path
|
||||
elif os.path.exists(global_config_path):
|
||||
path = global_config_path
|
||||
else:
|
||||
return config
|
||||
config.read(path)
|
||||
paths = [global_config_path, user_config_path]
|
||||
else:
|
||||
paths = [global_config_path, path, user_config_path]
|
||||
read_files = config.read(paths)
|
||||
if config.has_section('loggers'):
|
||||
logging.config.fileConfig(path)
|
||||
logging.config.fileConfig(paths)
|
||||
logger = logging.getLogger('wcs-olap')
|
||||
logger.info('config files: %s', ', '.join(read_files))
|
||||
return config
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue