mirror of
https://github.com/Shadowfita/docmost.git
synced 2025-11-24 13:41:02 +10:00
implement new invitation system
* fix comments on the frontend * move jwt token service to its own module * other fixes and updates
This commit is contained in:
@ -9,9 +9,21 @@ export class EnvironmentService {
|
||||
return this.configService.get<string>('NODE_ENV');
|
||||
}
|
||||
|
||||
getAppUrl(): string {
|
||||
return (
|
||||
this.configService.get<string>('APP_URL') ||
|
||||
'http://localhost:' + this.getPort()
|
||||
);
|
||||
}
|
||||
|
||||
getPort(): number {
|
||||
return parseInt(this.configService.get<string>('PORT'));
|
||||
}
|
||||
|
||||
getAppSecret(): string {
|
||||
return this.configService.get<string>('APP_SECRET');
|
||||
}
|
||||
|
||||
getDatabaseURL(): string {
|
||||
return this.configService.get<string>('DATABASE_URL');
|
||||
}
|
||||
|
||||
@ -7,6 +7,9 @@ export class EnvironmentVariables {
|
||||
|
||||
@IsUrl({ protocols: ['postgres', 'postgresql'], require_tld: false })
|
||||
DATABASE_URL: string;
|
||||
|
||||
@IsString()
|
||||
APP_SECRET: string;
|
||||
}
|
||||
|
||||
export function validate(config: Record<string, any>) {
|
||||
@ -14,7 +17,13 @@ export function validate(config: Record<string, any>) {
|
||||
|
||||
const errors = validateSync(validatedConfig);
|
||||
if (errors.length > 0) {
|
||||
throw new Error(errors.toString());
|
||||
errors.map((error) => {
|
||||
console.error(error.toString());
|
||||
});
|
||||
console.log(
|
||||
'Please fix the environment variables and try again. Shutting down...',
|
||||
);
|
||||
process.exit(1);
|
||||
}
|
||||
return validatedConfig;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user