@@ -15,8 +15,7 @@ import * as subs from "aws-cdk-lib/aws-sns-subscriptions";
1515import { Construct } from "constructs" ;
1616import { readAccountConfig } from "../../config/targets" ;
1717import { readResourceConfig } from "../../config/resources" ;
18- import * as fs from 'fs' ;
19-
18+ import variableConfigJson from "../../config/variables.json" ;
2019
2120const toolName = process . env . TOOL_NAME ?? "defaultToolName" ;
2221
@@ -29,8 +28,6 @@ class PluginStack extends cdk.Stack {
2928 constructor ( scope : Construct , id : string , props ?: cdk . StackProps ) {
3029 super ( scope , id , props ) ;
3130
32- const variableConfigJson = JSON . parse ( fs . readFileSync ( '../../config/variables.json' , 'utf-8' ) ) ;
33-
3431 const acctConfig = readAccountConfig ( "../../config/targets.yaml" ) ;
3532 const resourceConfig = readResourceConfig ( "../../config/resources.yaml" ) ;
3633
@@ -47,7 +44,7 @@ class PluginStack extends cdk.Stack {
4744 this . batchVcpus = acctConfig [ `${ toolName } ` ] ?. vcpus ?? "4" ;
4845 }
4946
50- const [ jobDefinition , jobQueue ] = this . initBatchFargate ( variableConfigJson ) ;
47+ const [ jobDefinition , jobQueue ] = this . initBatchFargate ( ) ;
5148 const batchFunction = this . initBatchLambda ( jobQueue , jobDefinition ) ;
5249 this . initSqsLambdaIntegration ( batchFunction , sqsQueue ) ;
5350
@@ -65,7 +62,7 @@ class PluginStack extends cdk.Stack {
6562 ) ;
6663 }
6764
68- private initBatchFargate ( variables : Array < string , string > ) : [ batch . CfnJobDefinition , batch . CfnJobQueue ] {
65+ private initBatchFargate ( ) : [ batch . CfnJobDefinition , batch . CfnJobQueue ] {
6966 const batchExecutionRole = new iam . Role (
7067 this ,
7168 `BatchExecutionRole-${ toolName } ` ,
@@ -121,11 +118,6 @@ class PluginStack extends cdk.Stack {
121118
122119 const containerImageUri = `${ this . adminAccountId } .dkr.ecr.us-east-1.amazonaws.com/${ toolName } :latest` ;
123120
124- const environmentVariables = Object . entries ( variables ) . map ( ( [ key , value ] ) => ( {
125- name : key ,
126- value : String ( value ) , // Ensure value is a string
127- } ) ) ;
128-
129121 const jobDefinition = new batch . CfnJobDefinition ( this , "JobDefn" , {
130122 type : "container" ,
131123 containerProperties : {
@@ -145,7 +137,7 @@ class PluginStack extends cdk.Stack {
145137 value : this . batchMemory ,
146138 } ,
147139 ] ,
148- environment : environmentVariables ,
140+ environment : variableConfigJson ,
149141 } ,
150142 platformCapabilities : [ "FARGATE" ] ,
151143 } ) ;
0 commit comments