X-Git-Url: https://git.decadent.org.uk/gitweb/?a=blobdiff_plain;f=dak%2Fadmin.py;h=218eea578ed7ef9bf5f78a32898f745570c91827;hb=42658acd4f03a531537afb8748c0459be3a7c386;hp=c7d770bae71ac7f8f4231f400236e3a4e6bd0dc4;hpb=1eccea7ca9d2ad6750a3e355cbbc201acbd834be;p=dak.git diff --git a/dak/admin.py b/dak/admin.py index c7d770ba..218eea57 100755 --- a/dak/admin.py +++ b/dak/admin.py @@ -343,10 +343,13 @@ def show_config(command): if mode == 'db': connstr = "" - if cnf["DB::Host"]: + if cnf.has_key("DB::Service"): + # Service mode + connstr = "postgresql://service=%s" % cnf["DB::Service"] + elif cnf.has_key("DB::Host"): # TCP/IP connstr = "postgres://%s" % cnf["DB::Host"] - if cnf["DB::Port"] and cnf["DB::Port"] != "-1": + if cnf.has_key("DB::Port") and cnf["DB::Port"] != "-1": connstr += ":%s" % cnf["DB::Port"] connstr += "/%s" % cnf["DB::Name"] else: @@ -356,12 +359,17 @@ def show_config(command): connstr += "?port=%s" % cnf["DB::Port"] print connstr elif mode == 'db-shell': - e = ['PGDATABASE'] - print "PGDATABASE=%s" % cnf["DB::Name"] - if cnf["DB::Host"]: + e = [] + if cnf.has_key("DB::Service"): + e.append('PGSERVICE') + print "PGSERVICE=%s" % cnf["DB::Service"] + if cnf.has_key("DB::Name"): + e.append('PGDATABASE') + print "PGDATABASE=%s" % cnf["DB::Name"] + if cnf.has_key("DB::Host"): print "PGHOST=%s" % cnf["DB::Host"] e.append('PGHOST') - if cnf["DB::Port"] and cnf["DB::Port"] != "-1": + if cnf.has_key("DB::Port") and cnf["DB::Port"] != "-1": print "PGPORT=%s" % cnf["DB::Port"] e.append('PGPORT') print "export " + " ".join(e)