refactor(debug): Be more concise in config description

This commit is contained in:
hygienic-books 2022-07-05 18:24:51 +02:00
parent b20e3abd1f
commit 687b5bf422

View File

@ -29,7 +29,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 # 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 # 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 # '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 = [ CFG_KNOWN_DEFAULTS = [
{"key": "self_name", "value": "{{ cookiecutter.__project_slug }}"}, {"key": "self_name", "value": "{{ cookiecutter.__project_slug }}"},
{"key": "tmp_base_dir", "value": os.path.join(CFG_THIS_FILE_DIRNAME, "data/tmp/%(self_name)s")}, {"key": "tmp_base_dir", "value": os.path.join(CFG_THIS_FILE_DIRNAME, "data/tmp/%(self_name)s")},
@ -41,8 +43,13 @@ class CONST(object):
{"key": "{{ cookiecutter.__project_slug_under }}_some_option", "value": "http://localhost:8000/api/query", "is_global": True}, {"key": "{{ cookiecutter.__project_slug_under }}_some_option", "value": "http://localhost:8000/api/query", "is_global": True},
{"key": "another_option", "value": "first", "is_global": True} {"key": "another_option", "value": "first", "is_global": True}
] ]
# In all sections other than 'default' the following settings are known and accepted. We silently ignore other # In all sections other than 'default' the following settings are known and accepted. We ignore other settings.
# settings. We use 'is_mandatory' to determine if we have to raise errors on missing 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 = [ CFG_KNOWN_SECTION = [
{"key": "min_duration", "is_mandatory": False}, {"key": "min_duration", "is_mandatory": False},
{"key": "max_duration", "is_mandatory": False}, {"key": "max_duration", "is_mandatory": False},