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:
16
main.py
16
main.py
@ -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):
|
||||
"""
|
||||
|
Reference in New Issue
Block a user