2
0
mirror of https://github.com/inventree/inventree-docs.git synced 2025-04-27 21:26:43 +00:00

Provide all readthedocs environment variables to the rendering context

This commit is contained in:
Oliver 2021-10-11 19:07:25 +11:00
parent cc8bac2895
commit a6b0859e38

View File

@ -37,6 +37,17 @@ def on_config(config, *args, **kwargs):
print("Building within READTHEDOCS environment!")
print(f" - Version: {rtd_version}")
print(f" - Language: {rtd_language}")
# Add *all* readthedocs related keys
readthedocs = {}
for key in os.environ.keys():
if key.lower().startswith('READTHEDOCS_'):
k = key.replace('READTHEDOCS_', '').lower()
readthedocs[k] = os.environ[key]
# Supply this to the context
config.readthedocs = readthedocs
else:
print("'READTHEDOCS' environment variable not found")