diff --git a/.github/workflows/e2e-test.yaml b/.github/workflows/e2e-test.yaml
index 7c9fe989..de33b871 100644
--- a/.github/workflows/e2e-test.yaml
+++ b/.github/workflows/e2e-test.yaml
@@ -36,7 +36,7 @@ jobs:
mvn $MVN_ARGS
env:
# See "End-to-end test application instructions" on the README.md to update the secret
- aicore: ${{ secrets.AICORE_SERVICE_KEY }}
+ AICORE_SERVICE_KEY: ${{ secrets.AICORE_SERVICE_KEY }}
- name: "Start Application Locally"
run: |
@@ -53,7 +53,7 @@ jobs:
done
env:
# See "End-to-end test application instructions" on the README.md to update the secret
- aicore: ${{ secrets.AICORE_SERVICE_KEY }}
+ AICORE_SERVICE_KEY: ${{ secrets.AICORE_SERVICE_KEY }}
- name: "Health Check"
# print response body with headers to stdout. q:body only O:print -:stdout S:headers
diff --git a/README.md b/README.md
index 813d9450..abb1aab2 100644
--- a/README.md
+++ b/README.md
@@ -407,13 +407,16 @@ For more customization, creating a [HeaderProvider](https://sap.github.io/cloud-
### Set AI Core credentials as environment variable
+- Running the application locally without a service binding will throw:
+
+ `Could not find any matching service bindings for service identifier 'aicore'`
- Go into the BTP Cockpit
- Instances and Subscriptions -> Instances -> AI Core -> View Credentials -> Copy JSON
-- Set it as an environment variable `aicore` in your IDE
+- Set it as an environment variable `AICORE_SERVICE_KEY` in your IDE
Or in your terminal:
```shell
-export aicore='{ "serviceurls": { "AI_API_URL": ...'
+export AICORE_SERVICE_KEY='{ "serviceurls": { "AI_API_URL": ...'
```
### Run the Spring Boot application
diff --git a/core/src/main/java/com/sap/ai/sdk/core/Core.java b/core/src/main/java/com/sap/ai/sdk/core/Core.java
index 0ccf5cc5..d831b6b4 100644
--- a/core/src/main/java/com/sap/ai/sdk/core/Core.java
+++ b/core/src/main/java/com/sap/ai/sdk/core/Core.java
@@ -74,7 +74,7 @@ private static String getOrchestrationDeployment(@Nonnull final String resourceG
/**
* Requires an AI Core service binding OR a service key in the environment variable {@code
- * aicore}.
+ * AICORE_SERVICE_KEY}.
*
* @return a generic AI Core
ApiClient.
*/
@@ -115,13 +115,13 @@ public static ApiClient getClient(@Nonnull final Destination destination) {
/**
* Requires an AI Core service binding OR a service key in the environment variable {@code
- * aicore}.
+ * AICORE_SERVICE_KEY}.
*
* @return a destination pointing to the AI Core service.
*/
@Nonnull
public static Destination getDestination() {
- final var serviceKey = System.getenv("aicore");
+ final var serviceKey = System.getenv("AICORE_SERVICE_KEY");
final var serviceKeyPresent = serviceKey != null;
final var aiCoreBindingPresent =
DefaultServiceBindingAccessor.getInstance().getServiceBindings().stream()
@@ -160,7 +160,7 @@ public static Destination getDestination() {
private static void addServiceBinding(@Nonnull final String serviceKey) {
log.info(
"""
- Found a service key in environment variable "aicore".
+ Found a service key in environment variable "AICORE_SERVICE_KEY".
Using a service key is recommended for local testing only.
Bind the AI Core service to the application for productive usage.""");
@@ -169,7 +169,7 @@ private static void addServiceBinding(@Nonnull final String serviceKey) {
credentials = new ObjectMapper().readValue(serviceKey, new TypeReference<>() {});
} catch (JsonProcessingException e) {
throw new AiCoreCredentialsInvalidException(
- "Error in parsing service key from the \"aicore\" environment variable.", e);
+ "Error in parsing service key from the \"AICORE_SERVICE_KEY\" environment variable.", e);
}
final var binding =
diff --git a/core/src/test/java/com/sap/ai/sdk/core/CoreTest.java b/core/src/test/java/com/sap/ai/sdk/core/CoreTest.java
index e4d34b0f..d76c1828 100644
--- a/core/src/test/java/com/sap/ai/sdk/core/CoreTest.java
+++ b/core/src/test/java/com/sap/ai/sdk/core/CoreTest.java
@@ -19,7 +19,7 @@ public class CoreTest {
@Test
@SneakyThrows
void getDestinationWithoutEnvVarFailsLocally() {
- variables.set("aicore", null);
+ variables.set("AICORE_SERVICE_KEY", null);
assertThatThrownBy(Core::getDestination)
.isExactlyInstanceOf(DestinationAccessException.class)
.hasMessage("Could not find any matching service bindings for service identifier 'aicore'");
@@ -28,17 +28,17 @@ void getDestinationWithoutEnvVarFailsLocally() {
@Test
@SneakyThrows
void getDestinationWithBrokenEnvVarFailsLocally() {
- variables.set("aicore", "");
+ variables.set("AICORE_SERVICE_KEY", "");
assertThatThrownBy(Core::getDestination)
.isExactlyInstanceOf(Core.AiCoreCredentialsInvalidException.class)
- .hasMessage("Error in parsing service key from the \"aicore\" environment variable.");
+ .hasMessage("Error in parsing service key from the \"AICORE_SERVICE_KEY\" environment variable.");
}
@Test
@SneakyThrows
void getDestinationWithEnvVarSucceedsLocally() {
variables.set(
- "aicore",
+ "AICORE_SERVICE_KEY",
"""
{
"clientid": "",