2
0
mirror of https://github.com/inventree/inventree-docs.git synced 2025-06-16 20:25:46 +00:00

Download the latest configuration template file when building

- So we don't have to manually copy it all the time!
This commit is contained in:
Oliver
2022-01-08 18:08:24 +11:00
parent 2d65233d0e
commit 7233e8c235
3 changed files with 101 additions and 2 deletions

16
main.py
View File

@ -1,8 +1,24 @@
import os
from posixpath import dirname
from urllib import request
def define_env(env):
# Ensure that the config template is always up to date
CFG_URL = "https://raw.githubusercontent.com/inventree/InvenTree/master/InvenTree/config_template.yaml"
response = request.urlopen(CFG_URL)
print(f"Reading config template from GitHub: Response {response.status}")
if response.status == 200:
data = response.read()
if len(data) > 0:
with open("_includes/config.yaml", "w") as f:
f.write(str(data.decode()))
@env.macro
def listimages(subdir):
"""