Mercurial Hosting > luan
comparison 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 |
comparison
equal
deleted
inserted
replaced
1180:8ca49f5e114d | 1181:51d1342e25ad |
---|---|
1 require "luan:logging/init.luan" -- initialize logging | |
1 local Luan = require "luan:Luan.luan" | 2 local Luan = require "luan:Luan.luan" |
2 local error = Luan.error | 3 local error = Luan.error |
3 local do_file = Luan.do_file or error() | 4 local do_file = Luan.do_file or error() |
4 local ipairs = Luan.ipairs or error() | 5 local ipairs = Luan.ipairs or error() |
5 local Io = require "luan:Io.luan" | 6 local Io = require "luan:Io.luan" |
6 local print = Io.print or error() | 7 local print = Io.print or error() |
7 local String = require "luan:String.luan" | 8 local String = require "luan:String.luan" |
8 local Hosting = require "luan:host/Hosting.luan" | 9 local Hosting = require "luan:host/Hosting.luan" |
9 require "luan:logging/init.luan" -- initialize logging | 10 local Logging = require "luan:logging/Logging.luan" |
11 local logger = Logging.logger "run" | |
10 | 12 |
11 | 13 |
12 local here = Io.schemes.file(".").canonical().to_string() | 14 local here = Io.schemes.file(".").canonical().to_string() |
13 Hosting.sites_dir = here.."/sites/" | 15 Hosting.sites_dir = here.."/sites/" |
16 | |
17 -- tmp | |
18 local Util = require "classpath:luan/host/Util.luan" | |
19 local sites_dir = Io.schemes.file(Hosting.sites_dir) | |
20 for _, site in ipairs(sites_dir.children()) do | |
21 local password_file = site.child("password") | |
22 if password_file.exists() then | |
23 local domain = site.name() | |
24 local password = password_file.read_text() | |
25 Util.write_password(domain,password) | |
26 password_file.delete() | |
27 logger.info("fixed password for "..domain) | |
28 end | |
29 end | |
30 | |
14 do_file "classpath:luan/host/main.luan" | 31 do_file "classpath:luan/host/main.luan" |
15 | |
16 | 32 |
17 | 33 |
18 -- web server | 34 -- web server |
19 | 35 |
20 java() | 36 java() |