|
20 | 20 | import java.util.function.BiFunction; |
21 | 21 | import java.util.function.Function; |
22 | 22 | import javax.annotation.Nonnull; |
| 23 | + |
| 24 | +import io.github.cdimascio.dotenv.DotenvBuilder; |
23 | 25 | import lombok.RequiredArgsConstructor; |
24 | 26 | import lombok.extern.slf4j.Slf4j; |
25 | 27 | import lombok.val; |
|
34 | 36 | @RequiredArgsConstructor |
35 | 37 | public class AiCoreService implements AiCoreDestination { |
36 | 38 |
|
| 39 | + private static final String AI_RESOURCE_GROUP = "URL.headers.AI-Resource-Group"; |
| 40 | + private static final DeploymentCache DEPLOYMENT_CACHE = new DeploymentCache(); |
| 41 | + private static final DotenvBuilder DOT_ENV = Dotenv.configure().ignoreIfMissing(); |
| 42 | + |
37 | 43 | Function<AiCoreService, Destination> baseDestinationHandler; |
38 | 44 | final BiFunction<AiCoreService, Destination, ApiClient> clientHandler; |
39 | 45 | final BiFunction<AiCoreService, Destination, DefaultHttpDestination.Builder> builderHandler; |
40 | 46 |
|
41 | | - private static final DeploymentCache DEPLOYMENT_CACHE = new DeploymentCache(); |
42 | | - |
43 | | - private static final String AI_RESOURCE_GROUP = "URL.headers.AI-Resource-Group"; |
44 | | - |
45 | | - /** loads the .env file from the root of the project */ |
46 | | - private static final Dotenv DOTENV = Dotenv.configure().ignoreIfMissing().load(); |
47 | 47 |
|
48 | 48 | /** The resource group is defined by AiCoreDeployment.withResourceGroup(). */ |
49 | 49 | @Nonnull String resourceGroup; |
@@ -163,7 +163,7 @@ public AiCoreDeployment forDeploymentByScenario(@Nonnull final String scenarioId |
163 | 163 | @Nonnull |
164 | 164 | protected Destination getBaseDestination() |
165 | 165 | throws DestinationAccessException, DestinationNotFoundException { |
166 | | - val serviceKey = DOTENV.get("AICORE_SERVICE_KEY"); |
| 166 | + val serviceKey = DOT_ENV.load().get("AICORE_SERVICE_KEY"); |
167 | 167 | return DestinationResolver.getDestination(serviceKey); |
168 | 168 | } |
169 | 169 |
|
|
0 commit comments