refactor: convert config variables to upper case

This commit is contained in:
Elias Schneider
2022-12-05 16:53:52 +01:00
parent d4a0f1a4f1
commit 0499548dd3
20 changed files with 54 additions and 51 deletions

View File

@@ -82,7 +82,7 @@ export class FileService {
const downloadToken = this.generateFileDownloadToken(shareId, fileId);
return `${this.config.get(
"appUrl"
"APP_URL"
)}/api/shares/${shareId}/files/${fileId}?token=${downloadToken}`;
}
@@ -96,7 +96,7 @@ export class FileService {
},
{
expiresIn: "10min",
secret: this.config.get("jwtSecret"),
secret: this.config.get("JWT_SECRET"),
}
);
}
@@ -104,7 +104,7 @@ export class FileService {
verifyFileDownloadToken(shareId: string, token: string) {
try {
const claims = this.jwtService.verify(token, {
secret: this.config.get("jwtSecret"),
secret: this.config.get("JWT_SECRET"),
});
return claims.shareId == shareId;
} catch {

View File

@@ -10,7 +10,7 @@ import { ConfigService } from "src/config/config.service";
export class FileValidationPipe implements PipeTransform {
constructor(private config: ConfigService) {}
async transform(value: any, metadata: ArgumentMetadata) {
if (value.size > this.config.get("maxFileSize"))
if (value.size > this.config.get("MAX_FILE_SIZE"))
throw new BadRequestException("File is ");
return value;
}