Skip to content

Commit 3a685c4

Browse files
committed
fix: throw an error, if there is no ADMINFORTH_SECRET variable in environment
1 parent 526cf72 commit 3a685c4

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

adminforth/modules/configValidator.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1255,6 +1255,14 @@ export default class ConfigValidator implements IConfigValidator {
12551255
throw new Error(`Invalid AdminForth config: ${errors.join(', ')}`);
12561256
}
12571257

1258+
const adminforthSecret = process.env.ADMINFORTH_SECRET;
1259+
if (!adminforthSecret) {
1260+
throw new Error(`ADMINFORTH_SECRET environment not set
1261+
Please set ADMINFORTH_SECRET environment variable to a random string to secure your admin panel.
1262+
ADMINFORTH_SECRET variable is used to sign JWT tokens
1263+
`);
1264+
}
1265+
12581266
this.adminforth.config = newConfig as AdminForthConfig;
12591267
}
12601268

0 commit comments

Comments
 (0)