diff options
author | Ted Trask <ttrask01@yahoo.com> | 2014-10-30 00:59:46 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2014-10-30 00:59:46 +0000 |
commit | 1b55948641c15d15ca01d09e2fb093b97f3cdb70 (patch) | |
tree | ccf91a884aa8ec78eeb6050bd4adb2a4184cb427 | |
parent | 06c12c2ea537b6d33d5a649fd657afc604face4d (diff) | |
download | acf-lib-1b55948641c15d15ca01d09e2fb093b97f3cdb70.tar.bz2 acf-lib-1b55948641c15d15ca01d09e2fb093b97f3cdb70.tar.xz |
Use the specified user for db.lua listdatabases
-rw-r--r-- | db.lua | 12 |
1 files changed, 10 insertions, 2 deletions
@@ -166,7 +166,16 @@ end export.listdatabases = function(dbobject) local result = {} if dbobject.engine == mymodule.engine.postgresql then - local cmd = {"psql", "-U", "postgres", "-lt"} + local cmd = {"psql", "-lt", "-U"} + local stdin + if dbobject.user and dbobject.user ~= "" then + cmd[#cmd+1] = dbobject.user + else + cmd[#cmd+1] = "postgres" + end + if dbobject.password and dbobject.password ~= "" then + -- Have never seen a need to use password + end if dbobject.host and dbobject.host ~= "" then cmd[#cmd+1] = "-h" cmd[#cmd+1] = dbobject.host @@ -176,7 +185,6 @@ export.listdatabases = function(dbobject) cmd[#cmd+1] = dbobject.port end cmd["stderr"]=subprocess.STDOUT -APP.logevent("calling: "..table.concat(cmd, " ")) local code, cmdresult = subprocess.call_capture(cmd) if code ~= 0 then error(cmdresult, 0) |