Skip to content

Commit

Permalink
Update code based on feedback
Browse files Browse the repository at this point in the history
 * Add try/catch block, update args, and move function call
 * Update code based on feedback, and send blog url in message
  • Loading branch information
SerpentBytes committed Dec 1, 2022
1 parent dc899cc commit befc455
Show file tree
Hide file tree
Showing 8 changed files with 306 additions and 1 deletion.
5 changes: 5 additions & 0 deletions config/env.development
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@ JWT_AUDIENCE=http://localhost
# How long should a JWT work before it expires
JWT_EXPIRES_IN=1h

# Slack Bolt auth
SLACK_BOT_TOKEN=
SIGNING_SECRET=
CHANNEL_ID=

################################################################################
# Image Service
################################################################################
Expand Down
5 changes: 5 additions & 0 deletions config/env.production
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ JWT_AUDIENCE=https://api.telescope.cdot.systems
# How long should a JWT work before it expires
JWT_EXPIRES_IN=1h

# Slack Bolt auth
SLACK_BOT_TOKEN=
SIGNING_SECRET=
CHANNEL_ID=


################################################################################
# Image Service
Expand Down
4 changes: 4 additions & 0 deletions config/env.staging
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ JWT_AUDIENCE=https://dev.api.telescope.cdot.systems
# How long should a JWT work before it expires
JWT_EXPIRES_IN=1h

# Slack Bolt auth
SLACK_BOT_TOKEN=
SIGNING_SECRET=
CHANNEL_ID=

################################################################################
# Image Service
Expand Down
4 changes: 4 additions & 0 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ services:
- JWT_ISSUER
- JWT_AUDIENCE
- JWT_SECRET
# Slack Bolt auth
- SLACK_BOT_TOKEN
- SIGNING_SECRET
- CHANNEL_ID
depends_on:
- traefik
labels:
Expand Down
203 changes: 203 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/api/sso/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"homepage": "https://github.com/Seneca-CDOT/telescope#readme",
"dependencies": {
"@senecacdot/satellite": "^1.29.0",
"@slack/bolt": "3.12.2",
"@supabase/supabase-js": "1.29.4",
"celebrate": "15.0.1",
"connect-redis": "6.1.3",
Expand Down
8 changes: 7 additions & 1 deletion src/api/sso/src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ const supabase = require('./supabase');
const User = require('./user');
const { matchOrigin, getUserId } = require('./util');

const publishSignUpMessage = require('./slack-bolt-client');

// Space-separated list of App origins that we know about and will allow
// to be used as part of login redirects. You only need to specify
// the origin (scheme://domain:port), for each of these vs. the full URL.
Expand Down Expand Up @@ -149,7 +151,6 @@ module.exports.createTelescopeUser = function createTelescopeUser() {
}

const response = await createNewProfile(id, req.body);

if (response.error) {
const {
status,
Expand All @@ -163,6 +164,11 @@ module.exports.createTelescopeUser = function createTelescopeUser() {
next(createError(status, 'Unable to create a Telescope profile'));
return;
}
try {
await publishSignUpMessage(req.body.displayName, req.body.githubUsername, req.body.blogUrl);
} catch (error) {
logger.warn(error.message);
}
next();
};
};
Expand Down
Loading

0 comments on commit befc455

Please sign in to comment.