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
diff -r edfbcd7f8833 -r db57d562c4bd src/luan/host/Util.luan --- 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
diff -r edfbcd7f8833 -r db57d562c4bd src/luan/host/init.luan --- 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
diff -r edfbcd7f8833 -r db57d562c4bd src/luan/modules/host/Hosting.luan --- 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")
diff -r edfbcd7f8833 -r db57d562c4bd src/luan/modules/http/Http.luan --- a/src/luan/modules/http/Http.luan Wed Oct 09 14:56:07 2019 -0600 +++ b/src/luan/modules/http/Http.luan Fri Oct 18 15:06:32 2019 -0600 @@ -177,5 +177,6 @@ Http.domain = nil -- set in domain specific cases Http.is_serving = false +Http.is_hosted = false return Http