Skip to content

Commit

Permalink
HTTP POST add setting
Browse files Browse the repository at this point in the history
http_post_ca_certs
http_post_ignore_ssl_errors
  • Loading branch information
nsano-rururu committed Nov 23, 2021
1 parent 446938b commit 795b385
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 0 deletions.
55 changes: 55 additions & 0 deletions src/components/config/alert/ConfigAlertHttpPost.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@
<label>JSON results will be POSTed to this URL</label>
</el-form-item>

<el-form-item label="CA Certs" prop="httpPostCaCerts">
<el-switch
id="httpPostCaCerts"
v-model="httpPostCaCerts"
:disabled="viewOnly"
@change="changeHttpPostCaCerts" />
</el-form-item>

<el-form-item label="Ignore SSL Errors" prop="httpPostIgnoreSslErrors">
<el-switch
id="httpPostIgnoreSslErrors"
v-model="httpPostIgnoreSslErrors"
:disabled="viewOnly"
@change="changeHttpPostIgnoreSslErrors" />
</el-form-item>

<el-form-item label="Timeout" prop="httpPostTimeout">
<el-input-number id="httpPostTimeout" v-model="httpPostTimeout" :disabled="viewOnly" />
<label>
Expand Down Expand Up @@ -70,6 +86,30 @@ export default {
}
},
httpPostIgnoreSslErrors: {
get() {
return this.$store.state.config.alert.httpPostIgnoreSslErrors;
},
set(value) {
this.$store.commit(
'config/alert/UPDATE_HTTP_POST_IGNORE_SSL_ERRORS',
value
);
}
},
httpPostCaCerts: {
get() {
return this.$store.state.config.alert.httpPostCaCerts;
},
set(value) {
this.$store.commit(
'config/alert/UPDATE_HTTP_POST_CA_CERTS',
value
);
}
},
httpPostTimeout: {
get() {
return this.$store.state.config.alert.httpPostTimeout;
Expand All @@ -96,6 +136,21 @@ export default {
},
methods: {
changeHttpPostIgnoreSslErrors(val) {
if (val) {
this.httpPostIgnoreSslErrors = true;
} else {
this.httpPostIgnoreSslErrors = false;
}
},
changeHttpPostCaCerts(val) {
if (val) {
this.httpPostCaCerts = true;
} else {
this.httpPostCaCerts = false;
}
}
}
};
</script>
Expand Down
10 changes: 10 additions & 0 deletions src/store/config/alert.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,8 @@ function initialState() {

/* HTTP POST */
httpPostUrl: '',
httpPostIgnoreSslErrors: false,
httpPostCaCerts: false,
httpPostTimeout: '',
httpPostProxy: '',
};
Expand Down Expand Up @@ -372,6 +374,14 @@ export default {
state.httpPostUrl = httpPostUrl;
},

UPDATE_HTTP_POST_IGNORE_SSL_ERRORS(state, httpPostIgnoreSslErrors) {
state.httpPostIgnoreSslErrors = httpPostIgnoreSslErrors;
},

UPDATE_HTTP_POST_CA_CERTS(state, httpPostCaCerts) {
state.httpPostCaCerts = httpPostCaCerts;
},

UPDATE_HTTP_POST_TIMEOUT(state, httpPostTimeout) {
state.httpPostTimeout = httpPostTimeout;
},
Expand Down
16 changes: 16 additions & 0 deletions src/store/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,14 @@ export default {
/* HTTP POST */
commit('alert/UPDATE_HTTP_POST_URL', config.http_post_url);

if (config.http_post_ignore_ssl_errors) {
commit('alert/UPDATE_HTTP_POST_IGNORE_SSL_ERRORS', config.http_post_ignore_ssl_errors);
}

if (config.http_post_ca_certs) {
commit('alert/UPDATE_HTTP_POST_CA_CERTS', config.http_post_ca_certs);
}

if (config.http_post_timeout) {
commit('alert/UPDATE_HTTP_POST_TIMEOUT', config.http_post_timeout);
} else {
Expand Down Expand Up @@ -1203,6 +1211,14 @@ export default {
config.http_post_url = state.alert.httpPostUrl;
}

if (state.alert.httpPostIgnoreSslErrors) {
config.http_post_ignore_ssl_errors = state.alert.httpPostIgnoreSslErrors;
}

if (state.alert.httpPostCaCerts) {
config.http_post_ca_certs = state.alert.httpPostCaCerts;
}

if (state.alert.httpPostTimeout) {
config.http_post_timeout = state.alert.httpPostTimeout;
}
Expand Down

0 comments on commit 795b385

Please sign in to comment.