diff --git a/openclaw-deploy/render.py b/openclaw-deploy/render.py new file mode 100644 index 0000000..3c769fa --- /dev/null +++ b/openclaw-deploy/render.py @@ -0,0 +1,28 @@ +import json +import os +from jinja2 import Template + +# 自动创建输出目录 +output_dir = "application" +if not os.path.exists(output_dir): + os.makedirs(output_dir) + +# 读取模板 +with open("template/template.yaml", "r", encoding="utf-8") as f: + template = Template(f.read()) + +# 读取多个用户配置 +with open("global.json", "r", encoding="utf-8") as f: + users = json.load(f) + +# 循环批量生成 +for user in users: + rendered_yaml = template.render(**user) + filename = os.path.join(output_dir, f"{user['user_id']}.yaml") + + with open(filename, "w", encoding="utf-8") as f: + f.write(rendered_yaml) + + print(f"✅ 已生成:{filename}") + +print(f"\n🎉 全部生成完成!共 {len(users)} 个文件") \ No newline at end of file