Mercurial Hosting > luan
changeset 1416:db57d562c4bd
add Http.is_hosted
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Fri, 18 Oct 2019 15:06:32 -0600 |
parents | edfbcd7f8833 |
children | c7f9dd062eda |
files | src/luan/host/Util.luan src/luan/host/init.luan src/luan/modules/host/Hosting.luan src/luan/modules/http/Http.luan |
diffstat | 4 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/src/luan/host/Util.luan Wed Oct 09 14:56:07 2019 -0600 +++ b/src/luan/host/Util.luan Fri Oct 18 15:06:32 2019 -0600 @@ -76,13 +76,18 @@ if pg_admin == nil then return end - local db = database{ - class = "org.postgresql.Driver" - url = "jdbc:postgresql://localhost:5432/"..domain - user = domain - password = password - } + local db = database(pg_admin) + local exists = db.query("select rolname from pg_roles where rolname=?",domain).results() ~= nil; db.close() + if exists then + db = database{ + class = "org.postgresql.Driver" + url = "jdbc:postgresql://localhost:5432/"..domain + user = domain + password = password + } + db.close() + end end return Util
--- a/src/luan/host/init.luan Wed Oct 09 14:56:07 2019 -0600 +++ b/src/luan/host/init.luan Fri Oct 18 15:06:32 2019 -0600 @@ -54,6 +54,7 @@ end Http.domain = domain +Http.is_hosted = true -- mail - fix later
--- a/src/luan/modules/host/Hosting.luan Wed Oct 09 14:56:07 2019 -0600 +++ b/src/luan/modules/host/Hosting.luan Fri Oct 18 15:06:32 2019 -0600 @@ -16,7 +16,6 @@ local Hosting = {} - function Hosting.push(domain,password,dir) local my_dir = Io.uri("file:"..dir) my_dir.exists() or error("directory '"..dir.."' not found")