Skip to content

Commit 22b1362

Browse files
Dotend load is static (#135)
1 parent 868c635 commit 22b1362

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

core/src/main/java/com/sap/ai/sdk/core/AiCoreService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ public class AiCoreService implements AiCoreDestination {
4242

4343
private static final String AI_RESOURCE_GROUP = "URL.headers.AI-Resource-Group";
4444

45+
/** loads the .env file from the root of the project */
46+
public static final Dotenv DOTENV = Dotenv.configure().ignoreIfMissing().load();
47+
4548
/** The resource group is defined by AiCoreDeployment.withResourceGroup(). */
4649
@Nonnull String resourceGroup;
4750

@@ -161,7 +164,7 @@ public AiCoreDeployment forDeploymentByScenario(@Nonnull final String scenarioId
161164
@Nonnull
162165
protected Destination getBaseDestination()
163166
throws DestinationAccessException, DestinationNotFoundException {
164-
val serviceKey = Dotenv.configure().ignoreIfMissing().load().get("AICORE_SERVICE_KEY");
167+
val serviceKey = DOTENV.get("AICORE_SERVICE_KEY");
165168
return DestinationResolver.getDestination(serviceKey);
166169
}
167170

0 commit comments

Comments
 (0)