File tree Expand file tree Collapse file tree 4 files changed +18
-3
lines changed
Expand file tree Collapse file tree 4 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ import {
3838 FCC_ENABLE_DEV_LOGIN_MODE ,
3939 FCC_ENABLE_SWAGGER_UI ,
4040 FCC_ENABLE_SHADOW_CAPTURE ,
41- FREECODECAMP_NODE_ENV
41+ FCC_ENABLE_EXAM_ENVIRONMENT
4242} from './utils/env' ;
4343import { isObjectID } from './utils/validation' ;
4444import {
@@ -187,8 +187,7 @@ export const build = async (
187187 }
188188 } ) ;
189189
190- // NOTE: Code behind the `FREECODECAMP_NODE_ENV` var is not ready to be deployed yet.
191- if ( FREECODECAMP_NODE_ENV !== 'production' ) {
190+ if ( FCC_ENABLE_EXAM_ENVIRONMENT ) {
192191 void fastify . register ( function ( fastify , _opts , done ) {
193192 fastify . addHook ( 'onRequest' , fastify . authorizeExamEnvironmentToken ) ;
194193
Original file line number Diff line number Diff line change @@ -12,6 +12,14 @@ import {
1212import * as mock from '../../../__mocks__/env-exam' ;
1313import { constructUserExam } from '../utils/exam' ;
1414
15+ jest . mock ( '../../utils/env' , ( ) => {
16+ // eslint-disable-next-line @typescript-eslint/no-unsafe-return
17+ return {
18+ ...jest . requireActual ( '../../utils/env' ) ,
19+ FCC_ENABLE_EXAM_ENVIRONMENT : 'true'
20+ } ;
21+ } ) ;
22+
1523describe ( '/exam-environment/' , ( ) => {
1624 setupServer ( ) ;
1725 describe ( 'Authenticated user with exam environment authorization token' , ( ) => {
Original file line number Diff line number Diff line change @@ -58,6 +58,11 @@ assert.ok(process.env.MONGOHQ_URL);
5858assert . ok ( process . env . COOKIE_SECRET ) ;
5959
6060if ( process . env . FREECODECAMP_NODE_ENV !== 'development' ) {
61+ assert . notEqual (
62+ process . env . FCC_ENABLE_EXAM_ENVIRONMENT ,
63+ 'true' ,
64+ 'Exam environment is not ready for production.'
65+ ) ;
6166 assert . ok ( process . env . SES_ID ) ;
6267 assert . ok ( process . env . SES_SECRET ) ;
6368 assert . notEqual (
@@ -127,6 +132,8 @@ export const FCC_ENABLE_DEV_LOGIN_MODE =
127132 process . env . FCC_ENABLE_DEV_LOGIN_MODE === 'true' ;
128133export const FCC_ENABLE_SHADOW_CAPTURE =
129134 process . env . FCC_ENABLE_SHADOW_CAPTURE === 'true' ;
135+ export const FCC_ENABLE_EXAM_ENVIRONMENT =
136+ process . env . FCC_ENABLE_EXAM_ENVIRONMENT === 'true' ;
130137export const SENTRY_DSN =
131138 process . env . SENTRY_DSN === 'dsn_from_sentry_dashboard'
132139 ? ''
Original file line number Diff line number Diff line change @@ -69,6 +69,7 @@ PORT=3000
6969FCC_ENABLE_SWAGGER_UI = true
7070FCC_ENABLE_DEV_LOGIN_MODE = true
7171FCC_ENABLE_SHADOW_CAPTURE = false
72+ FCC_ENABLE_EXAM_ENVIRONMENT = false
7273
7374# Email
7475# use ses in production
You can’t perform that action at this time.
0 commit comments