diff --git a/src/components/config/alert/ConfigAlertGoogleChat.vue b/src/components/config/alert/ConfigAlertGoogleChat.vue index e067ae72..ce161e7c 100644 --- a/src/components/config/alert/ConfigAlertGoogleChat.vue +++ b/src/components/config/alert/ConfigAlertGoogleChat.vue @@ -36,6 +36,14 @@ <label>URL to Kibana to include in the card footer.</label> </praeco-form-item> </div> + + <praeco-form-item label="Proxy" prop="googleChatProxy"> + <el-input id="googleChatProxy" v-model="googleChatProxy" :disabled="viewOnly" /> + <label> + By default ElastAlert 2 will not use a network proxy to send notifications to GoogleChat. + Set this option using hostname:port if you need to use a proxy. + </label> + </praeco-form-item> </div> </template> @@ -115,6 +123,18 @@ export default { value ); } + }, + + googleChatProxy: { + get() { + return this.$store.state.config.alert.googleChatProxy; + }, + set(value) { + this.$store.commit( + 'config/alert/UPDATE_GOOGLECHAT_PROXY', + value + ); + } } }, diff --git a/src/store/config/alert.js b/src/store/config/alert.js index 1e0accd5..2b45c33c 100644 --- a/src/store/config/alert.js +++ b/src/store/config/alert.js @@ -248,6 +248,7 @@ function initialState() { googleChatHeaderSubtitle: '', googleChatHeaderImage: '', googleFooterKibanalink: '', + googleChatProxy: '', /* Mattermost */ mattermostChannelOverride: '', @@ -1216,6 +1217,10 @@ export default { state.googleFooterKibanalink = googleFooterKibanalink; }, + UPDATE_GOOGLECHAT_PROXY(state, googleChatProxy) { + state.googleChatProxy = googleChatProxy; + }, + /* Mattermost */ UPDATE_MATTERMOST_CHANNEL_OVERRIDE(state, mattermostChannelOverride) { state.mattermostChannelOverride = mattermostChannelOverride; diff --git a/src/store/config/index.js b/src/store/config/index.js index ca7ffe1a..df084e15 100644 --- a/src/store/config/index.js +++ b/src/store/config/index.js @@ -378,7 +378,6 @@ export default { commit('alert/OPSGENIE_SUBJECT', config.opsgenie_subject); commit('alert/OPSGENIE_ALIAS', config.opsgenie_alias); commit('alert/OPSGENIE_PROXY', config.opsgenie_proxy); - commit('alert/OPSGENIE_PRIORITY', config.opsgenie_priority); commit('alert/OPSGENIE_DESCRIPTION', config.opsgenie_description); // TODO: opsgenie_priority @@ -653,6 +652,7 @@ export default { commit('alert/UPDATE_GOOGLECHAT_HEADER_SUBTITLE', config.googlechat_header_subtitle); commit('alert/UPDATE_GOOGLECHAT_HEADER_IMAGE', config.googlechat_header_image); commit('alert/UPDATE_GOOGLECHAT_FOOTER_KIBANALINK', config.googlechat_footer_kibanalink); + commit('alert/UPDATE_GOOGLECHAT_PROXY', config.googlechat_proxy); /* Mattermost */ commit('alert/UPDATE_MATTERMOST_CHANNEL_OVERRIDE', config.mattermost_channel_override); @@ -2369,6 +2369,10 @@ export default { config.googlechat_footer_kibanalink = state.alert.googleFooterKibanalink; } + if (state.alert.googleChatProxy) { + config.googlechat_proxy = state.alert.googleChatProxy; + } + return config; }, diff --git a/tests/unit/mockData/alert/ruleDataGoogleChat002.js b/tests/unit/mockData/alert/ruleDataGoogleChat002.js index 59084810..30de207b 100644 --- a/tests/unit/mockData/alert/ruleDataGoogleChat002.js +++ b/tests/unit/mockData/alert/ruleDataGoogleChat002.js @@ -16,6 +16,7 @@ googlechat_format: card googlechat_header_image: http://example/abc.png googlechat_header_subtitle: b googlechat_header_title: a +googlechat_proxy: hostname:8080 googlechat_webhook_url: http://example/abca import: BaseRule.config index: hannibal-* diff --git a/tests/unit/specs/alert/ConfigYamlGoogleChat002.spec.js b/tests/unit/specs/alert/ConfigYamlGoogleChat002.spec.js index 13d8dd5a..db43f5b7 100644 --- a/tests/unit/specs/alert/ConfigYamlGoogleChat002.spec.js +++ b/tests/unit/specs/alert/ConfigYamlGoogleChat002.spec.js @@ -29,6 +29,7 @@ googlechat_format: "card" googlechat_header_image: "http://example/abc.png" googlechat_header_subtitle: "b" googlechat_header_title: "a" +googlechat_proxy: "hostname:8080" googlechat_webhook_url: "http://example/abca" import: "BaseRule.config" index: "hannibal-*"