site_config.lua 455 B

123456789101112131415161718192021
  1. local config = os.getenv('GLUON_SITE_CONFIG') or '/lib/gluon/site.conf'
  2. local function loader()
  3. coroutine.yield('return ')
  4. coroutine.yield(io.open(config):read('*a'))
  5. end
  6. -- setfenv doesn't work with Lua 5.2 anymore, but we're using 5.1
  7. local site_config = setfenv(assert(load(coroutine.wrap(loader), 'site.conf')), {})()
  8. local setmetatable = setmetatable
  9. module 'gluon.site_config'
  10. setmetatable(_M,
  11. {
  12. __index = site_config,
  13. }
  14. )
  15. return _M