From dec656ca9c4e3dc2e80df83f3c199ec21abd9b07 Mon Sep 17 00:00:00 2001 From: Ed Burns Date: Mon, 28 Oct 2024 20:52:29 -0400 Subject: [PATCH] On branch 6295-usability-concerns Fixes #32 modified: .scripts/setup-env-variables-template.sh modified: README.md modified: src/main/java/org/eclipse/pathfinder/api/GraphTraversalService.java Signed-off-by: Ed Burns --- .scripts/setup-env-variables-template.sh | 2 +- README.md | 2 +- .../org/eclipse/pathfinder/api/GraphTraversalService.java | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.scripts/setup-env-variables-template.sh b/.scripts/setup-env-variables-template.sh index 505a24a..a3edcbb 100644 --- a/.scripts/setup-env-variables-template.sh +++ b/.scripts/setup-env-variables-template.sh @@ -3,7 +3,7 @@ export RESOURCE_GROUP_NAME="abc1110rg" # customize this export LOCATION=eastus # customize this, if desired export APPINSIGHTS_NAME="appinsights$(date +%s)" -export DB_NAME=${DB_RESOURCE_NAME} +export DB_NAME=libertydb export DB_PASSWORD="Secret123456" # PostgreSQL database password export DB_PORT_NUMBER=5432 export DB_SERVER_NAME="${DB_RESOURCE_NAME}.postgres.database.azure.com" # PostgreSQL host name diff --git a/README.md b/README.md index bb677b5..4567b8e 100644 --- a/README.md +++ b/README.md @@ -873,7 +873,7 @@ The steps in this section guide you to deploy supporting resources with the GitH * `DB_RESOURCE_NAME` must be the name of the database resource, such as `liberty-dbs-1148487969748`. Find this value by entering the resource group in which the workflow deployed the database and selecting the database resource. - * `DB_NAME` must be `postgres`. + * `DB_NAME` must be `libertydb`. * If using the AI shortest path feature, set the `AZURE_OPENAI` variables as described in Unit 1. diff --git a/src/main/java/org/eclipse/pathfinder/api/GraphTraversalService.java b/src/main/java/org/eclipse/pathfinder/api/GraphTraversalService.java index 5ca6e87..182d7ca 100644 --- a/src/main/java/org/eclipse/pathfinder/api/GraphTraversalService.java +++ b/src/main/java/org/eclipse/pathfinder/api/GraphTraversalService.java @@ -61,8 +61,9 @@ public List findShortestPath( @Size(min = 8, max = 8, message = "Deadline value must be eight characters long.") @QueryParam("deadline") String deadline) { - if (!System.getenv("AZURE_OPENAI_ENDPOINT").isEmpty() - && !System.getenv("AZURE_OPENAI_KEY").isEmpty()) { + String endpoint = System.getenv("AZURE_OPENAI_ENDPOINT"); + String key = System.getenv("AZURE_OPENAI_KEY"); + if ((null != endpoint && !endpoint.isEmpty()) && (null != key && !key.isEmpty())) { String shortestPath = getShortestPathWithTimeout(originUnLocode, destinationUnLocode); if (isValidJsonUsingJsonP(shortestPath) && !shortestPath.equals("[]")) { Jsonb jsonb = JsonbBuilder.create();