Skip to content

Commit

Permalink
let env var overrule .dot env setting (#2136)
Browse files Browse the repository at this point in the history
* let env var overrule .dot env setting

Summary: The script adlsgen2setup.py does not assign the "groups" ACL to individual files, and prepdocs.py does not check folder ACLs and created a copy of all folders in flat struture without any acls groups / rights. Consequently, the ACL is missing from the "group" field in the vector index —it remains empty. Files are accessible for anyone independent or the security group he is in

#2109

* Load azd env vars variable

---------

Co-authored-by: Pamela Fox <[email protected]>
  • Loading branch information
cforce and pamelafox authored Nov 19, 2024
1 parent 194876a commit 9e960ec
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
4 changes: 3 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
"env": {
"QUART_APP": "main:app",
"QUART_ENV": "development",
"QUART_DEBUG": "0"
"QUART_DEBUG": "0",
// Set this to "no-override" if you want env vars here to override AZD env vars
"LOADING_MODE_FOR_AZD_ENV_VARS": "override"
},
"args": [
"run",
Expand Down
10 changes: 8 additions & 2 deletions app/backend/load_azd_env.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import json
import logging
import os
import subprocess

from dotenv import load_dotenv
Expand All @@ -19,5 +20,10 @@ def load_azd_env():
env_file_path = entry["DotEnvPath"]
if not env_file_path:
raise Exception("No default azd env file found")
logger.info(f"Loading azd env from {env_file_path}")
load_dotenv(env_file_path, override=True)
loading_mode = os.getenv("LOADING_MODE_FOR_AZD_ENV_VARS") or "override"
if loading_mode == "no-override":
logger.info("Loading azd env from %s, but not overriding existing environment variables", env_file_path)
load_dotenv(env_file_path, override=False)
else:
logger.info("Loading azd env from %s, which may override existing environment variables", env_file_path)
load_dotenv(env_file_path, override=True)

0 comments on commit 9e960ec

Please sign in to comment.