Mercurial Hosting > luan
comparison src/luan/host/init.luan @ 1627:07be5015159d
better config
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Tue, 07 Dec 2021 22:15:16 -0700 |
parents | cf9dfead83a3 |
children | 570f3d483a31 |
comparison
equal
deleted
inserted
replaced
1626:cf9dfead83a3 | 1627:07be5015159d |
---|---|
66 Hosted.is_hosted = true | 66 Hosted.is_hosted = true |
67 | 67 |
68 | 68 |
69 -- postgres | 69 -- postgres |
70 | 70 |
71 require "java" | |
72 local WebHandler = require "java:luan.host.WebHandler" | |
71 local Sql = require "luan:sql/Sql.luan" | 73 local Sql = require "luan:sql/Sql.luan" |
72 local database = Sql.database or error() | 74 local database = Sql.database or error() |
73 local Logging = require "luan:logging/Logging.luan" | 75 local Logging = require "luan:logging/Logging.luan" |
74 local logger = Logging.logger "init" | 76 local logger = Logging.logger "init" |
75 | 77 |
76 local Config = require "file:Config.luan" | 78 local pg = WebHandler.config.postgres |
77 Config.password = nil -- security | |
78 local pg = Config.postgres | |
79 | 79 |
80 function Hosted.postgres_spec() | 80 function Hosted.postgres_spec() |
81 if pg == nil then | 81 if pg == nil then |
82 return nil | 82 return nil |
83 end | 83 end |
101 | 101 |
102 -- callback to luanhost code | 102 -- callback to luanhost code |
103 do_file "file:init.luan" | 103 do_file "file:init.luan" |
104 | 104 |
105 | 105 |
106 require "java" | |
107 local WebHandler = require "java:luan.host.WebHandler" | |
108 local LuanJava = require "java:luan.Luan" | 106 local LuanJava = require "java:luan.Luan" |
109 | 107 |
110 function Hosted.no_security(password) | 108 function Hosted.no_security(password) |
111 WebHandler.securityPassword == password or error "wrong password" | 109 WebHandler.config.password == password or error "wrong password" |
112 LuanJava.setSecurity(nil) | 110 LuanJava.setSecurity(nil) |
113 end | 111 end |
114 | 112 |
115 function Http.reset_luan() | 113 function Http.reset_luan() |
116 WebHandler.removeHandler(domain) | 114 WebHandler.removeHandler(domain) |