From c5ae3c0c8900fd70f89db69691cdd6f82e453990 Mon Sep 17 00:00:00 2001 From: hygienic-books Date: Tue, 5 Jul 2022 04:44:45 +0200 Subject: [PATCH] docs(config): Add examples to config defaults --- update-firewall-source.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/update-firewall-source.py b/update-firewall-source.py index 11942e3..44a87c4 100644 --- a/update-firewall-source.py +++ b/update-firewall-source.py @@ -33,7 +33,9 @@ class CONST(object): # Values you don't have to set, these are their internal defaults. You may optionally add a key 'is_global' equal # to either True or False. By default if left off it'll be assumed False. Script will treat values where # 'is_global' equals True as not being overridable in a '[section]'. It's a setting that only makes sense in a - # global context for the entire script. + # global context for the entire script. An option where 'empty_ok' equals True can safely be unset or set to + # an empty string. An example config.ini file may give a sane config example value here, removing that value + # still results in a valid file. CFG_KNOWN_DEFAULTS = [ {"key": "target", "value": "ACCEPT", "is_global": False}, {"key": "addr", "value": "", "is_global": False}, @@ -42,8 +44,13 @@ class CONST(object): {"key": "do_config_check", "value": "true", "is_global": True}, {"key": "restart_firewalld_after_change", "value": "true", "is_global": True} ] - # In all sections other than 'default' the following settings are known and accepted. We silently ignore other - # settings. We use 'is_mandatory' to determine if we have to raise errors on missing settings. + # In all sections other than 'default' the following settings are known and accepted. We ignore other settings. + # Per CFG_KNOWN_DEFAULTS above most '[DEFAULT]' options are accepted by virtue of being defaults and overridable. + # The only exception are options where "is_global" equals True, they can't be overridden in '[sections]'; any + # attempt at doing it anyway will be ignored. The main purpose of this list is to name settings that do not have + # a default value but can - if set - influence how a '[section]' behaves. Repeating a '[DEFAULT]' here does not + # make sense. We use 'is_mandatory' to determine if we have to raise errors on missing settings. Here + # 'is_mandatory' means the setting must be given in a '[section]'. It may be empty. CFG_KNOWN_SECTION = [ {"key": "target", "is_mandatory": False}, {"key": "addr", "is_mandatory": False},