docker environment control improvement
This commit is contained in:
@@ -142,14 +142,8 @@ class OpenVPNDataGatherer:
|
||||
'agg_6h_retention_days': '180', # 6 месяцев
|
||||
'agg_1d_retention_days': '365' # 12 месяцев
|
||||
},
|
||||
'visualization': {
|
||||
'refresh_interval': '5',
|
||||
'max_display_rows': '50'
|
||||
},
|
||||
'certificates': {
|
||||
'certificates_path': '/opt/ovpn/pki/issued',
|
||||
'certificate_extensions': 'crt'
|
||||
}
|
||||
'visualization': {},
|
||||
'certificates': {}
|
||||
}
|
||||
|
||||
try:
|
||||
@@ -214,6 +208,12 @@ class OpenVPNDataGatherer:
|
||||
|
||||
def get_config_value(self, section, key, default=None):
|
||||
try:
|
||||
# Priority: ENV > Config File > Fallback
|
||||
# Format: OVPMON_SECTION_KEY (all uppercase, underscores for spaces/dashes)
|
||||
env_key = f"OVPMON_{section.upper()}_{key.upper()}".replace('-', '_').replace(' ', '_')
|
||||
env_val = os.getenv(env_key)
|
||||
if env_val is not None:
|
||||
return env_val
|
||||
return self.config.get(section, key, fallback=default)
|
||||
except:
|
||||
return default
|
||||
|
||||
Reference in New Issue
Block a user