Skip to content
Snippets Groups Projects
Commit c87b1032 authored by esha's avatar esha
Browse files

Fixed empty arg. for pg connection.

parent 24c2d06a
No related branches found
No related tags found
No related merge requests found
......@@ -4,9 +4,6 @@ import os
try:
(host, port, user, password, db) = os.getenv('PG').split(':')
for val in (host, port, user, password, db):
if not val.strip():
raise ValueError ('Empty value')
if not os.path.exists(os.path.join(self.args.builddir, 'src/module/pg/pg.so')):
raise RuntimeError('No PG module found')
except (RuntimeError, TypeError, NameError, AttributeError, ValueError):
......
......@@ -23,7 +23,7 @@ exec admin "lua c = box.net.sql.connect('pg')"
exec admin "lua dump = function(v) return box.cjson.encode(v) end"
exec admin "lua connect = {}"
exec admin "lua for tk in string.gmatch(os.getenv('PG'), '[^:]+') do table.insert(connect, tk) end"
exec admin "lua for tk in string.gmatch(os.getenv('PG')..':', '(.-):') do table.insert(connect, tk) end"
# postgresql
exec admin "lua c = box.net.sql.connect('pg', unpack(connect))"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment