* integrate websocket redis adapter
* use APP_SECRET for jwt signing
* auto migrate database on startup in production
* add updatedAt to update db operations
* create enterprise ee package directory
* fix comment editor focus
* other fixes
This commit is contained in:
Philipinho
2024-06-07 17:29:34 +01:00
parent eef9081aaf
commit 38ef610e5e
36 changed files with 541 additions and 166 deletions

View File

@ -5,8 +5,8 @@ import { ConfigService } from '@nestjs/config';
export class EnvironmentService {
constructor(private configService: ConfigService) {}
getEnv(): string {
return this.configService.get<string>('NODE_ENV');
getNodeEnv(): string {
return this.configService.get<string>('NODE_ENV', 'development');
}
getAppUrl(): string {
@ -17,7 +17,7 @@ export class EnvironmentService {
}
getPort(): number {
return parseInt(this.configService.get<string>('PORT'));
return parseInt(this.configService.get<string>('PORT', '3000'));
}
getAppSecret(): string {
@ -28,20 +28,19 @@ export class EnvironmentService {
return this.configService.get<string>('DATABASE_URL');
}
getJwtSecret(): string {
return this.configService.get<string>('JWT_SECRET_KEY');
getRedisUrl(): string {
return this.configService.get<string>(
'REDIS_URL',
'redis://localhost:6379',
);
}
getJwtTokenExpiresIn(): string {
return this.configService.get<string>('JWT_TOKEN_EXPIRES_IN');
return this.configService.get<string>('JWT_TOKEN_EXPIRES_IN', '30d');
}
getStorageDriver(): string {
return this.configService.get<string>('STORAGE_DRIVER');
}
getLocalStoragePath(): string {
return this.configService.get<string>('LOCAL_STORAGE_PATH');
return this.configService.get<string>('STORAGE_DRIVER', 'local');
}
getAwsS3AccessKeyId(): string {
@ -68,27 +67,12 @@ export class EnvironmentService {
return this.configService.get<string>('AWS_S3_URL');
}
getAwsS3UsePathStyleEndpoint(): boolean {
return this.configService.get<boolean>('AWS_S3_USE_PATH_STYLE_ENDPOINT');
}
isCloud(): boolean {
const cloudConfig = this.configService
.get<string>('CLOUD', 'false')
.toLowerCase();
return cloudConfig === 'true';
}
isSelfHosted(): boolean {
return !this.isCloud();
}
getMailDriver(): string {
return this.configService.get<string>('MAIL_DRIVER', 'log');
}
getMailHost(): string {
return this.configService.get<string>('MAIL_HOST', '127.0.0.1');
return this.configService.get<string>('MAIL_HOST');
}
getMailPort(): number {
@ -115,10 +99,14 @@ export class EnvironmentService {
return this.configService.get<string>('POSTMARK_TOKEN');
}
getRedisUrl(): string {
return this.configService.get<string>(
'REDIS_URL',
'redis://@127.0.0.1:6379',
);
isCloud(): boolean {
const cloudConfig = this.configService
.get<string>('CLOUD', 'false')
.toLowerCase();
return cloudConfig === 'true';
}
isSelfHosted(): boolean {
return !this.isCloud();
}
}