keywords can be set from UI

This commit is contained in:
DaKheera47
2025-12-26 22:25:55 +00:00
parent bd7baafbec
commit 572cb1d42d
9 changed files with 250 additions and 76 deletions
+20 -1
View File
@@ -17,11 +17,30 @@ const locations = [
];
// roles
const roles = [
const defaultRoles = [
"web-development",
"software-systems",
];
let roles = defaultRoles;
const envRolesRaw = process.env.GRADCRACKER_SEARCH_TERMS;
if (envRolesRaw) {
try {
const parsed = JSON.parse(envRolesRaw) as string[];
if (Array.isArray(parsed) && parsed.length > 0) {
roles = parsed.map(term =>
term.toLowerCase()
.replace(/[^a-z0-9]+/g, '-')
.replace(/^-+|-+$/g, '')
);
console.log(`Using configured search terms: ${roles.join(', ')}`);
}
} catch (e) {
console.warn('Failed to parse GRADCRACKER_SEARCH_TERMS', e);
}
}
// combo of locations and roles
const gradcrackerUrls = locations.flatMap((location) => {
return roles.map((role) => {