Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ dotenv.config();
*
* _Exported as `githubOauth` for configuring GitHub passport strategy._
*/
if (!process.env.GITHUB_CLIENT_ID || !process.env.GITHUB_CLIENT_SECRET) {
throw new Error('GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET environment variables are required');
}
export const githubOauth = {
/**
* Client ID of OAuth application.
Expand All @@ -28,6 +31,9 @@ export const githubOauth = {
* _Exported as `sessionSecret` to configure cookie creation._
*
*/
if (!process.env.SESSION_SECRET) {
throw new Error('SESSION_SECRET environment variable is required');
}
export const sessionSecret: string = process.env.SESSION_SECRET;

/**
Expand All @@ -53,4 +59,4 @@ export const allowedOrigins: string[] = [
* _Exported as `nodeEnv` to differentiate behavior of app on development and
* production server._
*/
export const nodeEnv: string = process.env.NODE_ENV;
export const nodeEnv: string = process.env.NODE_ENV ?? 'development';
2 changes: 1 addition & 1 deletion config/passport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ passport.use(new GitHubStrategy({
clientSecret: githubOauth.GITHUB_CLIENT_SECRET,
callbackURL: `${hostUrl}${authUrl.callback}`,
scope: ['gist'],
}, (accessToken, refreshToken, profile, done) => {
}, (accessToken: string, refreshToken: string, profile: any, done: (error: any, user?: any) => void) => {

if (!profile) {
return done(new Error('Failed to retrieve GitHub profile'));
Expand Down
Loading