Skip to content
Open
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: 8 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,11 @@ MATCHING_SERVICE_LUNGEVITY_CANCER_TYPES = lung
MATCHING_SERVICE_TRIALJECTORY_LABEL = "TrialJectory"
MATCHING_SERVICE_TRIALJECTORY_URL = "http://localhost/trialjectory"
MATCHING_SERVICE_TRIALJECTORY_CANCER_TYPES = breast, lung, colon, brain, prostate, multipleMyeloma, bladder

# For testing purposes, this is the patient information used for FHIRless mode
# (use <server root>/search?fhirless for this mode)
# Some of the info is useless (like the patient name) but can be set anyway
FHIRLESS_PATIENT_NAME="Test Launch"
FHIRLESS_PATIENT_GENDER=male
FHIRLESS_PATIENT_AGE=35
FHIRLESS_PATIENT_ZIPCODE="$DEFAULT_ZIP_CODE"
2 changes: 1 addition & 1 deletion next-env.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
// see https://nextjs.org/docs/pages/building-your-application/configuring/typescript for more information.
15 changes: 11 additions & 4 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ const matchingServices = enabledMatchingServices.split(/\s*,\s*/).map(service =>
};
});

function parseResultsMax() {
let value = Number(process.env.RESULTS_MAX);
return isNaN(value) || value < 1 ? 15 : value;
function parseEnvInt(stringValue, defaultValue, min, max) {
let value = Number(stringValue);
return isNaN(value) ? defaultValue : Math.min(Math.max(Math.floor(value), min), max);
}

/** @type {import('next').NextConfig} */
Expand All @@ -52,9 +52,16 @@ module.exports = {
disableSearchLocation: JSON.parse(process.env.DISABLE_SEARCH_LOCATION ?? 'false'),
defaultSearchZipCode: process.env.DEFAULT_SEARCH_ZIP_CODE,
defaultSearchTravelDistance: process.env.DEFAULT_SEARCH_TRAVEL_DISTANCE,
resultsMax: parseResultsMax(),
resultsMax: parseEnvInt(process.env.RESULTS_MAX, 15, 1, 15),
siteRubric: allowedSiteRubrics.includes(process.env.SITE_RUBRIC) ? process.env.SITE_RUBRIC : 'none',
services: matchingServices,
fhirlessPatient: {
id: 'example',
name: process.env.FHIRLESS_PATIENT_NAME ?? 'Test Launch',
gender: process.env.FHIRLESS_PATIENT_GENDER ?? 'male',
age: parseEnvInt(process.env.FHIRLESS_PATIENT_AGE, 35, 1, 150),
zipcode: process.env.FHIRLESS_PATIENT_ZIPCODE ?? null,
},
},
serverRuntimeConfig: {
sessionSecretKey: process.env.SESSION_SECRET_KEY,
Expand Down
Loading