您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

generate_apache_conf.py 552 B

1234567891011121314151617
  1. import os
  2. from jinja2 import Template
  3. if __name__ == "__main__":
  4. fqdn = os.environ.get("FQDN", "localhost")
  5. context = {
  6. "FQDN": fqdn,
  7. "SSL_CERTIFICATE_FILE": "/etc/httpd/ssl/%s.crt" % fqdn,
  8. "SSL_CERTIFICATE_KEY_FILE": "/etc/httpd/ssl/private/%s.key" % fqdn,
  9. "DEBUG": os.environ.get("DEBUG", "0") == "1",
  10. }
  11. print(context)
  12. jinja_template = Template(open("/opt/app/lesspass.conf.j2").read())
  13. with open("/etc/httpd/conf.d/lesspass.conf", "w") as f:
  14. f.write(jinja_template.render(context))