changeset 1626:cf9dfead83a3

use Config.postgres
author Franklin Schmidt <fschmidt@gmail.com>
date Tue, 07 Dec 2021 18:30:02 -0700
parents 57c8baadb357
children 07be5015159d
files src/luan/host/Util.luan src/luan/host/init.luan
diffstat 2 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
diff -r 57c8baadb357 -r cf9dfead83a3 src/luan/host/Util.luan
--- a/src/luan/host/Util.luan	Sun Sep 05 12:32:27 2021 -0600
+++ b/src/luan/host/Util.luan	Tue Dec 07 18:30:02 2021 -0700
@@ -34,10 +34,11 @@
 	file.write_text("return "..stringify{password=password}.."\n")
 end
 
-local pg_admin = Package.load("file:postgres.luan")
+local Config = require "file:Config.luan"
+local pg_admin = Config.postgres
 
 function Util.set_postgres_password(domain,password)
-	if pg_admin == false then
+	if pg_admin == nil then
 		return
 	end
 	local db = database(pg_admin)
@@ -50,7 +51,7 @@
 end
 
 function Util.check_postgres_password(domain,password)
-	if pg_admin == false then
+	if pg_admin == nil then
 		return
 	end
 	local db = database(pg_admin)
diff -r 57c8baadb357 -r cf9dfead83a3 src/luan/host/init.luan
--- a/src/luan/host/init.luan	Sun Sep 05 12:32:27 2021 -0600
+++ b/src/luan/host/init.luan	Tue Dec 07 18:30:02 2021 -0700
@@ -73,10 +73,12 @@
 local Logging = require "luan:logging/Logging.luan"
 local logger = Logging.logger "init"
 
-local pg = Package.load("file:postgres.luan")
+local Config = require "file:Config.luan"
+Config.password = nil  -- security
+local pg = Config.postgres
 
 function Hosted.postgres_spec()
-	if pg == false then
+	if pg == nil then
 		return nil
 	end
 	local spec = {