@@ -13,6 +13,7 @@ import io.airbyte.config.Configs
13
13
import io.airbyte.workers.process.Metadata.AWS_ACCESS_KEY_ID
14
14
import io.airbyte.workers.process.Metadata.AWS_SECRET_ACCESS_KEY
15
15
import io.airbyte.workload.launcher.constants.EnvVarConstants
16
+ import io.airbyte.workload.launcher.constants.EnvVarConstants.LOCAL_SECRETS_MICRONAUT_ENV
16
17
import io.airbyte.workload.launcher.model.toEnvVarList
17
18
import io.airbyte.workload.launcher.model.toRefEnvVarList
18
19
import io.fabric8.kubernetes.api.model.EnvVar
@@ -323,20 +324,28 @@ class EnvVarConfigBeanFactory {
323
324
324
325
/* *
325
326
* Map of env vars for specifying the Micronaut environment.
326
- * Indirectly necessary for configuring API client auth.
327
+ * Indirectly necessary for configuring API client auth and the local test secrets db
327
328
*/
328
329
@Singleton
329
330
@Named(" micronautEnvMap" )
330
- fun micronautEnvMap (): Map <String , String > {
331
- val envMap: MutableMap <String , String > = HashMap ()
331
+ fun micronautEnvMap (
332
+ @Value(" \$ {airbyte.secret.persistence}" ) secretPersistenceType : String ,
333
+ ): Map <String , String > {
334
+ val envs = mutableListOf (EnvVarConstants .WORKER_V2_MICRONAUT_ENV )
332
335
333
- if (System .getenv(Environment .ENVIRONMENTS_ENV ) != null ) {
334
- envMap[Environment .ENVIRONMENTS_ENV ] = " ${EnvVarConstants .WORKER_V2_MICRONAUT_ENV } ,${System .getenv(Environment .ENVIRONMENTS_ENV )} "
335
- } else {
336
- envMap[Environment .ENVIRONMENTS_ENV ] = EnvVarConstants .WORKER_V2_MICRONAUT_ENV
336
+ // inherit from the parent env
337
+ System .getenv(Environment .ENVIRONMENTS_ENV )?.let {
338
+ envs.add(it)
337
339
}
338
340
339
- return envMap
341
+ // add this conditionally to trigger datasource bean creation via application.yaml
342
+ if (secretPersistenceType == Configs .SecretPersistenceType .TESTING_CONFIG_DB_TABLE .toString()) {
343
+ envs.add(LOCAL_SECRETS_MICRONAUT_ENV )
344
+ }
345
+
346
+ val commaSeparatedEnvString = envs.joinToString(separator = " ," )
347
+
348
+ return mapOf (Environment .ENVIRONMENTS_ENV to commaSeparatedEnvString)
340
349
}
341
350
342
351
/* *
0 commit comments