Skip to content

Commit 9e960ec

Browse files
cforcepamelafox
andauthored
let env var overrule .dot env setting (#2136)
* 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]>
1 parent 194876a commit 9e960ec

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

.vscode/launch.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@
1414
"env": {
1515
"QUART_APP": "main:app",
1616
"QUART_ENV": "development",
17-
"QUART_DEBUG": "0"
17+
"QUART_DEBUG": "0",
18+
// Set this to "no-override" if you want env vars here to override AZD env vars
19+
"LOADING_MODE_FOR_AZD_ENV_VARS": "override"
1820
},
1921
"args": [
2022
"run",

app/backend/load_azd_env.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import json
22
import logging
3+
import os
34
import subprocess
45

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

0 commit comments

Comments
 (0)