fix: add DATABASE_URI to environment variables in CLI command execution

This commit is contained in:
Théophile Diot 2024-11-20 12:33:47 +01:00
parent 3d7648dac0
commit 0f930e66aa
No known key found for this signature in database
GPG key ID: FA995104A0BA376A
2 changed files with 4 additions and 1 deletions

View file

@ -307,7 +307,7 @@ class CLI(ApiCaller):
cmd.extend(args)
self.__logger.debug(f"Executing command {' '.join(cmd)}")
proc = run(cmd, stdin=DEVNULL, stderr=STDOUT, check=False, env=self.__variables | environ | ({"LOG_LEVEL": "DEBUG"} if debug else {})) # type: ignore
proc = run(cmd, stdin=DEVNULL, stderr=STDOUT, check=False, env=self.__variables | environ | ({"LOG_LEVEL": "DEBUG"} if debug else {}) | ({"DATABASE_URI": self.__db.database_uri} if self.__db else {})) # type: ignore
if proc.returncode != 0:
return False, f"Command {command} failed"

View file

@ -60,6 +60,9 @@ if __name__ == "__main__":
# Parse args
args = parser.parse_args()
if args.debug:
logger.setLevel("DEBUG")
# Instantiate CLI
cli = CLI()