comparison src/luan/host/Util.luan @ 1416:db57d562c4bd

add Http.is_hosted
author Franklin Schmidt <fschmidt@gmail.com>
date Fri, 18 Oct 2019 15:06:32 -0600
parents 1979cff9aad2
children 732b5de211fc
comparison
equal deleted inserted replaced
1415:edfbcd7f8833 1416:db57d562c4bd
74 74
75 function Util.check_postgres_password(domain,password) 75 function Util.check_postgres_password(domain,password)
76 if pg_admin == nil then 76 if pg_admin == nil then
77 return 77 return
78 end 78 end
79 local db = database{ 79 local db = database(pg_admin)
80 class = "org.postgresql.Driver" 80 local exists = db.query("select rolname from pg_roles where rolname=?",domain).results() ~= nil;
81 url = "jdbc:postgresql://localhost:5432/"..domain
82 user = domain
83 password = password
84 }
85 db.close() 81 db.close()
82 if exists then
83 db = database{
84 class = "org.postgresql.Driver"
85 url = "jdbc:postgresql://localhost:5432/"..domain
86 user = domain
87 password = password
88 }
89 db.close()
90 end
86 end 91 end
87 92
88 return Util 93 return Util