add test token
This commit is contained in:
2
.github/workflows/deploy.yml
vendored
2
.github/workflows/deploy.yml
vendored
@@ -26,7 +26,7 @@ jobs:
|
||||
name: 'Coffee'
|
||||
entry_point: Coffee
|
||||
description: 'Ping selected group of members on mattermost when coffee is mentioned'
|
||||
env_vars: 'MATTERMOST_TOKEN=${{ secrets.MATTERMOST_TOKEN }}'
|
||||
env_vars: 'MATTERMOST_TOKEN=${{ secrets.MATTERMOST_TOKEN }},TEST_TOKEN=${{ secrets.TEST_TOKEN }}'
|
||||
runtime: 'go119'
|
||||
memory_mb: 128
|
||||
region: 'europe-west1'
|
||||
|
||||
@@ -30,6 +30,7 @@ type message struct {
|
||||
// Coffee() replies to mattermost webhooks with the correct token value
|
||||
func Coffee(writer http.ResponseWriter, request *http.Request) {
|
||||
mattermost_token := os.Getenv("MATTERMOST_TOKEN")
|
||||
test_token := os.Getenv("TEST_TOKEN")
|
||||
|
||||
if mattermost_token == "" {
|
||||
log.Printf("Failed to load mattermost token")
|
||||
@@ -46,7 +47,7 @@ func Coffee(writer http.ResponseWriter, request *http.Request) {
|
||||
}
|
||||
|
||||
log.Printf("Coffee requested by user id: %+v", incoming_msg.User_id)
|
||||
if incoming_msg.Token == mattermost_token || incoming_msg.Token == "33szr8spqi8tx81ymdsxpq5mjh" {
|
||||
if incoming_msg.Token == mattermost_token || incoming_msg.Token == test_token {
|
||||
json.NewEncoder(writer).Encode(&reply{Response_type: "comment", Text: "@omorud @ksarband @psvihra"})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user