@@ -92,6 +92,9 @@ export class ConfigWebhook extends BaseConfig {
92
92
this . loadParameter ( process . env . PARAMETER_RUNNER_MATCHER_CONFIG_PATH , 'matcherConfig' ) ,
93
93
this . loadParameter ( process . env . PARAMETER_GITHUB_APP_WEBHOOK_SECRET , 'webhookSecret' ) ,
94
94
] ) ;
95
+
96
+ validateWebhookSecret ( this ) ;
97
+ validateRunnerMatcherConfig ( this ) ;
95
98
}
96
99
}
97
100
@@ -104,6 +107,9 @@ export class ConfigWebhookEventBridge extends BaseConfig {
104
107
this . loadEnvVar ( process . env . ALLOWED_EVENTS , 'allowedEvents' , [ ] ) ;
105
108
this . loadEnvVar ( process . env . EVENT_BUS_NAME , 'eventBusName' ) ;
106
109
await this . loadParameter ( process . env . PARAMETER_GITHUB_APP_WEBHOOK_SECRET , 'webhookSecret' ) ;
110
+
111
+ validateEventBusName ( this ) ;
112
+ validateWebhookSecret ( this ) ;
107
113
}
108
114
}
109
115
@@ -116,9 +122,24 @@ export class ConfigDispatcher extends BaseConfig {
116
122
this . loadEnvVar ( process . env . REPOSITORY_ALLOW_LIST , 'repositoryAllowList' , [ ] ) ;
117
123
await this . loadParameter ( process . env . PARAMETER_RUNNER_MATCHER_CONFIG_PATH , 'matcherConfig' ) ;
118
124
119
- // check matcherConfig object is not empty
120
- if ( this . matcherConfig . length === 0 ) {
121
- this . configLoadingErrors . push ( 'Matcher config is empty' ) ;
122
- }
125
+ validateRunnerMatcherConfig ( this ) ;
126
+ }
127
+ }
128
+
129
+ function validateEventBusName ( config : ConfigWebhookEventBridge ) : void {
130
+ if ( ! config . eventBusName ) {
131
+ config . configLoadingErrors . push ( 'Environment variable for eventBusName is not set and no default value provided.' ) ;
132
+ }
133
+ }
134
+
135
+ function validateWebhookSecret ( config : ConfigWebhookEventBridge | ConfigWebhook ) : void {
136
+ if ( ! config . webhookSecret ) {
137
+ config . configLoadingErrors . push ( 'Environment variable for webhookSecret is not set and no default value provided.' ) ;
138
+ }
139
+ }
140
+
141
+ function validateRunnerMatcherConfig ( config : ConfigDispatcher | ConfigWebhook ) : void {
142
+ if ( config . matcherConfig . length === 0 ) {
143
+ config . configLoadingErrors . push ( 'Matcher config is empty' ) ;
123
144
}
124
145
}
0 commit comments