changeset 1627:07be5015159d

better config
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 07 Dec 2021 22:15:16 -0700
parents cf9dfead83a3
children 520707a70379
files src/luan/host/Util.luan src/luan/host/WebHandler.java src/luan/host/init.luan
diffstat 3 files changed, 8 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/luan/host/Util.luan	Tue Dec 07 18:30:02 2021 -0700
+++ b/src/luan/host/Util.luan	Tue Dec 07 22:15:16 2021 -0700
@@ -34,8 +34,9 @@
 	file.write_text("return "..stringify{password=password}.."\n")
 end
 
-local Config = require "file:Config.luan"
-local pg_admin = Config.postgres
+require "java"
+local WebHandler = require "java:luan.host.WebHandler"
+local pg_admin = WebHandler.config.postgres
 
 function Util.set_postgres_password(domain,password)
 	if pg_admin == nil then
--- a/src/luan/host/WebHandler.java	Tue Dec 07 18:30:02 2021 -0700
+++ b/src/luan/host/WebHandler.java	Tue Dec 07 22:15:16 2021 -0700
@@ -97,7 +97,7 @@
 		}
 	};
 
-	public static String securityPassword = "password";  // change for security
+	public static LuanTable config;
 	private static final DomainHandler domainHandler = new DomainHandler(factory);
 	private static String sitesDir = null;
 
--- a/src/luan/host/init.luan	Tue Dec 07 18:30:02 2021 -0700
+++ b/src/luan/host/init.luan	Tue Dec 07 22:15:16 2021 -0700
@@ -68,14 +68,14 @@
 
 -- postgres
 
+require "java"
+local WebHandler = require "java:luan.host.WebHandler"
 local Sql = require "luan:sql/Sql.luan"
 local database = Sql.database or error()
 local Logging = require "luan:logging/Logging.luan"
 local logger = Logging.logger "init"
 
-local Config = require "file:Config.luan"
-Config.password = nil  -- security
-local pg = Config.postgres
+local pg = WebHandler.config.postgres
 
 function Hosted.postgres_spec()
 	if pg == nil then
@@ -103,12 +103,10 @@
 do_file "file:init.luan"
 
 
-require "java"
-local WebHandler = require "java:luan.host.WebHandler"
 local LuanJava = require "java:luan.Luan"
 
 function Hosted.no_security(password)
-	WebHandler.securityPassword == password or error "wrong password"
+	WebHandler.config.password == password or error "wrong password"
 	LuanJava.setSecurity(nil)
 end