diff src/luan/host/run.luan @ 1181:51d1342e25ad

luanhost password handling
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 20 Feb 2018 19:50:30 -0700
parents 707a5d874f3e
children
line wrap: on
line diff
--- a/src/luan/host/run.luan	Wed Feb 14 16:49:56 2018 -0700
+++ b/src/luan/host/run.luan	Tue Feb 20 19:50:30 2018 -0700
@@ -1,3 +1,4 @@
+require "luan:logging/init.luan"  -- initialize logging
 local Luan = require "luan:Luan.luan"
 local error = Luan.error
 local do_file = Luan.do_file or error()
@@ -6,15 +7,30 @@
 local print = Io.print or error()
 local String = require "luan:String.luan"
 local Hosting = require "luan:host/Hosting.luan"
-require "luan:logging/init.luan"  -- initialize logging
+local Logging = require "luan:logging/Logging.luan"
+local logger = Logging.logger "run"
 
 
 local here = Io.schemes.file(".").canonical().to_string()
 Hosting.sites_dir = here.."/sites/"
+
+-- tmp
+local Util = require "classpath:luan/host/Util.luan"
+local sites_dir = Io.schemes.file(Hosting.sites_dir)
+for _, site in ipairs(sites_dir.children()) do
+	local password_file = site.child("password")
+	if password_file.exists() then
+		local domain = site.name()
+		local password = password_file.read_text()
+		Util.write_password(domain,password)
+		password_file.delete()
+		logger.info("fixed password for "..domain)
+	end
+end
+
 do_file "classpath:luan/host/main.luan"
 
 
-
 -- web server
 
 java()