gen-site-conf.lua 444 B

1234567891011121314151617
  1. #!/usr/bin/lua
  2. function replace_patterns(value, subst)
  3. for k, v in pairs(subst) do
  4. value = value:gsub(k, v)
  5. end
  6. return value
  7. end
  8. dofile(os.getenv('GLUON_SITEDIR') ..'/extra/default.conf')
  9. local template = os.getenv('GLUON_SITEDIR') ..'/extra/template.conf'
  10. local site = os.getenv('GLUON_SITEDIR') ..'/site.conf'
  11. local config = io.open(template):read('*a')
  12. config = replace_patterns(config, subst)
  13. io.open(site, 'w'):write(config)