Skip to content

Commit

Permalink
fix: fixed env and auth bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed Oct 21, 2019
1 parent 0be8bbb commit 0a3f1dd
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
12 changes: 11 additions & 1 deletion template/.env.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ WEB_HOST=localhost
WEB_PORT=3000
WEB_PROTOCOL=http
WEB_URL={{WEB_PROTOCOL}}://{{WEB_HOST}}:{{WEB_PORT}}
WEB_SSL_KEY_PATH=
WEB_SSL_CERT_PATH=
LIVERELOAD_PORT=35729

################
Expand All @@ -24,6 +26,8 @@ API_HOST=localhost
API_PORT=4000
API_PROTOCOL=http
API_URL={{API_PROTOCOL}}://{{API_HOST}}:{{API_PORT}}
API_SSL_KEY_PATH=
API_SSL_CERT_PATH=

#########
## app ##
Expand Down Expand Up @@ -52,7 +56,7 @@ AUTH_STRIPE_ENABLED=false
# https://console.developers.google.com
GOOGLE_CLIENT_ID=
GOOGLE_CLIENT_SECRET=
GOOGLE_CALLBACK_URL={{WEB_URL}}/auth/google/ok
GOOGLE_CALLBACK_URL={{{WEB_URL}}}/auth/google/ok
# used by `mandarin` translation package
GOOGLE_TRANSLATE_KEY=
# your Postmark token from:
Expand Down Expand Up @@ -94,3 +98,9 @@ API_REDIS_PASSWORD=
BULL_REDIS_PORT=6379
BULL_REDIS_HOST=localhost
BULL_REDIS_PASSWORD=

#############
## certbot ##
#############
CERTBOT_WELL_KNOWN_NAME=
CERTBOT_WELL_KNOWN_CONTENTS=
10 changes: 10 additions & 0 deletions template/.env.schema
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ WEB_HOST=
WEB_PORT=
WEB_PROTOCOL=
WEB_URL=
WEB_SSL_KEY_PATH=
WEB_SSL_CERT_PATH=
LIVERELOAD_PORT=

################
Expand All @@ -24,6 +26,8 @@ API_HOST=
API_PORT=
API_PROTOCOL=
API_URL=
API_SSL_KEY_PATH=
API_SSL_CERT_PATH=

#########
## app ##
Expand Down Expand Up @@ -94,3 +98,9 @@ API_REDIS_PASSWORD=
BULL_REDIS_PORT=
BULL_REDIS_HOST=
BULL_REDIS_PASSWORD=

#############
## certbot ##
#############
CERTBOT_WELL_KNOWN_NAME=
CERTBOT_WELL_KNOWN_CONTENTS=
1 change: 1 addition & 0 deletions template/app/controllers/web/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ async function catchError(ctx, next) {
try {
await next();
} catch (err) {
ctx.logger.error(err);
if (ctx.params.provider === 'google' && err.message === 'Consent required')
return ctx.redirect('/auth/google/consent');
ctx.flash('error', err.message);
Expand Down
2 changes: 1 addition & 1 deletion template/routes/web/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ router
(ctx, next) =>
passport.authenticate(
ctx.params.provider,
config.auth[ctx.params.provider]
config.passport[ctx.params.provider]
)(ctx, next)
)
.get(
Expand Down

0 comments on commit 0a3f1dd

Please sign in to comment.