mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-03 03:52:15 +03:00
Optimize Glances configuration file path search
This commit is contained in:
parent
2379ec6b55
commit
5a78e72419
@ -117,6 +117,7 @@ class Config:
|
|||||||
self.config_dir = config_dir
|
self.config_dir = config_dir
|
||||||
self.config_filename = 'glances.conf'
|
self.config_filename = 'glances.conf'
|
||||||
self._loaded_config_file = None
|
self._loaded_config_file = None
|
||||||
|
self._config_file_paths = self.config_file_paths()
|
||||||
|
|
||||||
# Re pattern for optimize research of `foo`
|
# Re pattern for optimize research of `foo`
|
||||||
self.re_pattern = re.compile(r'(\`.+?\`)')
|
self.re_pattern = re.compile(r'(\`.+?\`)')
|
||||||
@ -164,7 +165,7 @@ class Config:
|
|||||||
|
|
||||||
def read(self):
|
def read(self):
|
||||||
"""Read the config file, if it exists. Using defaults otherwise."""
|
"""Read the config file, if it exists. Using defaults otherwise."""
|
||||||
for config_file in self.config_file_paths():
|
for config_file in self._config_file_paths:
|
||||||
logger.debug(f'Search glances.conf file in {config_file}')
|
logger.debug(f'Search glances.conf file in {config_file}')
|
||||||
if os.path.exists(config_file):
|
if os.path.exists(config_file):
|
||||||
try:
|
try:
|
||||||
|
@ -95,7 +95,7 @@ class GlancesPluginModel:
|
|||||||
# Init the limits (configuration keys) dictionary
|
# Init the limits (configuration keys) dictionary
|
||||||
self._limits = {}
|
self._limits = {}
|
||||||
if config is not None:
|
if config is not None:
|
||||||
logger.debug(f'Load section {self.plugin_name} in {config.config_file_paths()}')
|
logger.debug(f'Load section {self.plugin_name} in Glances configuration file')
|
||||||
self.load_limits(config=config)
|
self.load_limits(config=config)
|
||||||
|
|
||||||
# Init the alias (dictionnary)
|
# Init the alias (dictionnary)
|
||||||
|
Loading…
Reference in New Issue
Block a user