2
0
mirror of https://github.com/inventree/InvenTree.git synced 2026-04-25 12:33:33 +00:00

Ensure configuration settings are documented (#11674)

* Export configuration keys to JSON

* Support rendering of config options in docs

* Check for missing config settings

* Simplify macro

* Initial tests

* Fix collisions

* Updates

* Ensure values are stringified

* Ensure null values are exported correctly

* Refactor database config

- Observability on the config settings

* More docs updates

* Updates

* Add observability of cache settings

* More updates

* Observability

* Set env config for RTD

* Revert RTD config file

- Handled by ENV VAR on RTD account

* Visibility on background worker settings

* Tweaks

* Tweaks

* Split tracing settings out into separate file

- Improved discovery
- declutter settings.py

* Cleanup LDAP settings

* Social providers docs

* More updates

* Refactor ldap setup into own module

* Tweaks

* Formatting tweaks

* Tweak logic

* Fix INVENTREE_SESSION_COOKIE_SECURE setting

* Fix wrapping

* Add custom default
This commit is contained in:
Oliver
2026-04-21 12:23:53 +10:00
committed by GitHub
parent 3c9b014939
commit d81a87225c
20 changed files with 754 additions and 635 deletions
+30
View File
@@ -34,6 +34,7 @@ for key in [
print(f' - {key}: {val}')
# Cached settings dict values
global CONFIG_SETTINGS
global GLOBAL_SETTINGS
global USER_SETTINGS
global TAGS
@@ -64,6 +65,7 @@ with open(settings_file, encoding='utf-8') as sf:
GLOBAL_SETTINGS = settings['global']
USER_SETTINGS = settings['user']
CONFIG_SETTINGS = settings['config']
# Tags
with open(gen_base.joinpath('inventree_tags.yml'), encoding='utf-8') as f:
@@ -377,6 +379,34 @@ def define_env(env):
return rendersetting(key, setting, short=short)
@env.macro
def configtable():
"""Generate a header for the configuration settings table."""
return '| Environment Variable | Configuration File | Default | Description |\n| --- | --- | --- | --- |'
@env.macro
def configsetting(key: str, default: Optional[str] = None):
"""Extract information on a particular configuration setting.
Arguments:
key: The name of the configuration setting to extract information for.
default: An optional default value to override the setting's default display value.
"""
global CONFIG_SETTINGS
setting = CONFIG_SETTINGS[key]
observe_setting(key, 'config')
cfg_key = setting.get('config_key', None)
cfg_key = f'`{cfg_key}`' if cfg_key else '-'
default = default or setting.get('default_value', None)
if default is None:
default = '*Not Specified*'
return f'| <span title="{key}" style="white-space: nowrap;"><code>{key}</code></span> | {cfg_key} | {default} |'
@env.macro
def tags_and_filters():
"""Return a list of all tags and filters."""