changeset 1209:cff4a7d778a6

luanhost - load all sites at start
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 09 Mar 2018 14:56:18 -0700
parents 1e23b913c327
children 3db95cc00d09
files src/luan/host/run.luan
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
diff -r 1e23b913c327 -r cff4a7d778a6 src/luan/host/run.luan
--- a/src/luan/host/run.luan	Thu Mar 08 17:29:39 2018 -0700
+++ b/src/luan/host/run.luan	Fri Mar 09 14:56:18 2018 -0700
@@ -2,6 +2,7 @@
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
 local do_file = Luan.do_file or error()
+local ipairs = Luan.ipairs or error()
 local Io = require "luan:Io.luan"
 local Hosting = require "luan:host/Hosting.luan"
 local Logging = require "luan:logging/Logging.luan"
@@ -28,3 +29,10 @@
 handler = SafeHandler.new(handler)
 local server = Server.ForAddress.new("127.0.0.1",8080,handler)
 server.start()
+
+
+local sites_dir = Io.schemes.file(Hosting.sites_dir)
+for _, site_dir in ipairs(sites_dir.children()) do
+	local name = site_dir.name()
+	WebHandler.loadHandler(name)
+end