Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
PADME Central Service
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
PADME-PHT Development
PADME Central Service
Commits
b5ce6b26
Commit
b5ce6b26
authored
1 year ago
by
Sabith Haneef
Browse files
Options
Downloads
Patches
Plain Diff
Catch slack error. Only send slack if enabled.
parent
91ed1640
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
controllers/station.js
+31
-27
31 additions, 27 deletions
controllers/station.js
docker-compose.dev.yml
+4
-3
4 additions, 3 deletions
docker-compose.dev.yml
docker-compose.template.yml
+4
-3
4 additions, 3 deletions
docker-compose.template.yml
with
39 additions
and
33 deletions
controllers/station.js
+
31
−
27
View file @
b5ce6b26
...
...
@@ -540,33 +540,37 @@ module.exports = {
});
});
//SEND onboarding msg to a slack channel
try
{
const
message
=
[
'
#onboarding
'
,
'
```
'
,
`STATION_ID=
${
stationUsername
}
`
,
`STATION_NAME=
${
stationName
}
`
,
`EMAIL=
${
stationEmailAddress
}
`
,
'
```
'
].
join
(
'
\n
'
)
const
client
=
await
slackBotUtil
.
getClientInstance
();
const
channelId
=
slackBotUtil
.
getPadmeChannelId
();
await
client
.
files
.
upload
({
// channels can be a list of one to many strings
channels
:
channelId
,
initial_comment
:
message
,
file
:
Buffer
.
from
(
envBufferEncrypted
),
filename
:
"
env
"
,
title
:
"
env
"
});
console
.
log
(
'
Slack message sent
'
);
// Call station registry to update cache to include newly on boarded station
getStationList
();
}
catch
(
error
)
{
console
.
log
(
error
);
//SEND onboarding msg to a slack channel if enabled
if
(
process
.
env
.
SLACK_INTEGRATION_ENABLED
===
'
true
'
)
{
try
{
const
message
=
[
'
#onboarding
'
,
'
```
'
,
`STATION_ID=
${
stationUsername
}
`
,
`STATION_NAME=
${
stationName
}
`
,
`EMAIL=
${
stationEmailAddress
}
`
,
'
```
'
].
join
(
'
\n
'
)
const
client
=
await
slackBotUtil
.
getClientInstance
();
const
channelId
=
slackBotUtil
.
getPadmeChannelId
();
await
client
.
files
.
upload
({
// channels can be a list of one to many strings
channels
:
channelId
,
initial_comment
:
message
,
file
:
Buffer
.
from
(
envBufferEncrypted
),
filename
:
"
env
"
,
title
:
"
env
"
}).
catch
(
err
=>
{
console
.
log
(
`Unable to send slack message:
${
err
}
`
);
});
console
.
log
(
'
Slack message sent
'
);
// Call station registry to update cache to include newly on boarded station
getStationList
();
}
catch
(
error
)
{
console
.
log
(
error
);
}
}
return
res
.
status
(
200
).
send
();
...
...
This diff is collapsed.
Click to expand it.
docker-compose.dev.yml
+
4
−
3
View file @
b5ce6b26
...
...
@@ -55,9 +55,10 @@ services:
VAULT_PORT
:
8200
VAULT_ROLE_ID
:
${CENTRAL_SERVICE_VAULT_ROLE_ID}
VAULT_SECRET_ID
:
${CENTRAL_SERVICE_VAULT_SECRET_ID}
SLACK_BOT_TOKEN
:
${CENTRAL_SERVICE_SLACK_BOT_TOKEN}
SLACK_SIGNING_SECRET
:
${CENTRAL_SERVICE_SLACK_SIGNING_SECRET}
SLACK_PADME_CHANNEL_ID
:
${CENTRAL_SERVICE_SLACK_CHANNEL_ID}
SLACK_BOT_TOKEN
:
${CENTRAL_SERVICE_SLACK_BOT_TOKEN-}
SLACK_SIGNING_SECRET
:
${CENTRAL_SERVICE_SLACK_SIGNING_SECRET-}
SLACK_PADME_CHANNEL_ID
:
${CENTRAL_SERVICE_SLACK_CHANNEL_ID-}
SLACK_INTEGRATION_ENABLED
:
${CENTRAL_SERVICE_SLACK_INTEGRATION_ENABLED-false}
MINIO_PORT
:
9000
MINIO_ENDPOINT
:
"
minio-$USER"
MINIO_USE_SSL
:
"
false"
...
...
This diff is collapsed.
Click to expand it.
docker-compose.template.yml
+
4
−
3
View file @
b5ce6b26
...
...
@@ -37,9 +37,10 @@ services:
VAULT_PORT
:
8200
VAULT_ROLE_ID
:
${CENTRAL_SERVICE_VAULT_ROLE_ID}
VAULT_SECRET_ID
:
${CENTRAL_SERVICE_VAULT_SECRET_ID}
SLACK_BOT_TOKEN
:
${CENTRAL_SERVICE_SLACK_BOT_TOKEN}
SLACK_SIGNING_SECRET
:
${CENTRAL_SERVICE_SLACK_SIGNING_SECRET}
SLACK_PADME_CHANNEL_ID
:
${CENTRAL_SERVICE_SLACK_CHANNEL_ID}
SLACK_BOT_TOKEN
:
${CENTRAL_SERVICE_SLACK_BOT_TOKEN-}
SLACK_SIGNING_SECRET
:
${CENTRAL_SERVICE_SLACK_SIGNING_SECRET-}
SLACK_PADME_CHANNEL_ID
:
${CENTRAL_SERVICE_SLACK_CHANNEL_ID-}
SLACK_INTEGRATION_ENABLED
:
${CENTRAL_SERVICE_SLACK_INTEGRATION_ENABLED-false}
MINIO_PORT
:
9000
MINIO_ENDPOINT
:
minio
MINIO_USE_SSL
:
"
false"
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment