mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 09:57:09 +00:00
Prefer environment variables to connect to DB
This commit is contained in:
@@ -17,7 +17,14 @@ def read (file = None):
|
||||
if file is None:
|
||||
file = prefix+"/etc/config.yaml"
|
||||
with open(file, "r") as fd:
|
||||
return _load(fd)
|
||||
cfg = _load(fd)
|
||||
|
||||
if "db" in cfg and "connection_string" in cfg["db"] and os.environ.get("PGDATABASE"):
|
||||
# This should cause the PostgreSQL library to use the environment variables
|
||||
cfg["db"]["connection_string"] = ""
|
||||
print("Using environment variables for database connection")
|
||||
|
||||
return cfg
|
||||
|
||||
def files (globspec = None, include_archived = False):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user