Skip to content

Commit

Permalink
allow overriding env variable
Browse files Browse the repository at this point in the history
  • Loading branch information
cymed committed Sep 30, 2024
1 parent 5a69a78 commit 1d76895
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions plugin/teksi_wastewater/interlis/utils/various.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import tempfile
import uuid
from typing import List

from qgis.core import QgsExpression
from ...utils.database_utils import DatabaseUtils
from ...utils.plugin_utils import logger

Expand Down Expand Up @@ -60,7 +60,10 @@ def get_pgconf_as_ili_args() -> List[str]:
f.write(param + "\n")
args.extend(["--dbparams", '"' + os.path.join(dbparams_path, "dbparams.txt") + '"'])
if not pgconf["user"]:
args.extend(["--dbusr", '"' + os.getenv("USERNAME") + '"'])
# allow loading PGUSER from overriden env variables
expression = QgsExpression('@PGUSER')
pguser = expression.evaluate()
args.extend(["--dbusr", f'"{pguser}"'])
return args


Expand Down

0 comments on commit 1d76895

Please sign in to comment.