Skip to content

Commit e90920f

Browse files
pamelafoxrgrey
andauthored
Move check for AZURE_PUBLIC_NETWORK_ACCESS (#2209)
* Update prepdocs.sh to set the AZURE_USE_AUTHENTICATION correctly based on the environment equivalent * resolve conversation * Move check into prepdocs.py --------- Co-authored-by: Richard Grey <[email protected]>
1 parent 1be8653 commit e90920f

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

app/backend/app.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,6 @@
102102

103103
@bp.route("/")
104104
async def index():
105-
# TODO: use msal loginRedirect on a blankish page
106105
return await bp.send_static_file("index.html")
107106

108107

app/backend/prepdocs.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,7 @@ async def main(strategy: Strategy, setup_index: bool = True):
241241

242242
if __name__ == "__main__":
243243
parser = argparse.ArgumentParser(
244-
description="Prepare documents by extracting content from PDFs, splitting content into sections, uploading to blob storage, and indexing in a search index.",
245-
epilog="Example: prepdocs.py '.\\data\*' -v",
244+
description="Prepare documents by extracting content from PDFs, splitting content into sections, uploading to blob storage, and indexing in a search index."
246245
)
247246
parser.add_argument("files", nargs="?", help="Files to be processed")
248247

@@ -302,6 +301,10 @@ async def main(strategy: Strategy, setup_index: bool = True):
302301

303302
load_azd_env()
304303

304+
if os.getenv("AZURE_PUBLIC_NETWORK_ACCESS") == "Disabled":
305+
logger.error("AZURE_PUBLIC_NETWORK_ACCESS is set to Disabled. Exiting.")
306+
exit(0)
307+
305308
use_int_vectorization = os.getenv("USE_FEATURE_INT_VECTORIZATION", "").lower() == "true"
306309
use_gptvision = os.getenv("USE_GPT4V", "").lower() == "true"
307310
use_acls = os.getenv("AZURE_ADLS_GEN2_STORAGE_ACCOUNT") is not None

scripts/prepdocs.sh

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,6 @@
44

55
echo 'Running "prepdocs.py"'
66

7-
AZURE_USE_AUTHENTICATION=$(azd env get-value AZURE_PUBLIC_NETWORK_ACCESS)
8-
AZURE_PUBLIC_NETWORK_ACCESS=$(azd env get-value AZURE_PUBLIC_NETWORK_ACCESS)
9-
10-
if [ -n "$AZURE_USE_AUTHENTICATION" ] && [ "$AZURE_PUBLIC_NETWORK_ACCESS" = "Disabled" ]; then
11-
echo "AZURE_PUBLIC_NETWORK_ACCESS is set to Disabled. Exiting."
12-
exit 0
13-
fi
14-
157
additionalArgs=""
168
if [ $# -gt 0 ]; then
179
additionalArgs="$@"

0 commit comments

Comments
 (0)