refactor: convert config variables to upper case
This commit is contained in:
@@ -28,7 +28,7 @@ export class AuthController {
|
||||
@Throttle(10, 5 * 60)
|
||||
@Post("signUp")
|
||||
async signUp(@Body() dto: AuthRegisterDTO) {
|
||||
if (!this.config.get("allowRegistration"))
|
||||
if (!this.config.get("ALLOW_REGISTRATION"))
|
||||
throw new ForbiddenException("Registration is not allowed");
|
||||
return this.authService.signUp(dto);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class AuthService {
|
||||
email: dto.email,
|
||||
username: dto.username,
|
||||
password: hash,
|
||||
isAdmin: !this.config.get("setupFinished"),
|
||||
isAdmin: !this.config.get("SETUP_FINISHED"),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -74,7 +74,7 @@ export class AuthService {
|
||||
throw new ForbiddenException("Invalid password");
|
||||
|
||||
const hash = await argon.hash(newPassword);
|
||||
|
||||
|
||||
this.prisma.user.update({
|
||||
where: { id: user.id },
|
||||
data: { password: hash },
|
||||
@@ -89,7 +89,7 @@ export class AuthService {
|
||||
},
|
||||
{
|
||||
expiresIn: "15min",
|
||||
secret: this.config.get("jwtSecret"),
|
||||
secret: this.config.get("JWT_SECRET"),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ export class JwtGuard extends AuthGuard("jwt") {
|
||||
try {
|
||||
return (await super.canActivate(context)) as boolean;
|
||||
} catch {
|
||||
return this.config.get("allowUnauthenticatedShares");
|
||||
return this.config.get("ALLOW_UNAUTHENTICATED_SHARES");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,10 +8,10 @@ import { PrismaService } from "src/prisma/prisma.service";
|
||||
@Injectable()
|
||||
export class JwtStrategy extends PassportStrategy(Strategy) {
|
||||
constructor(config: ConfigService, private prisma: PrismaService) {
|
||||
config.get("jwtSecret");
|
||||
config.get("JWT_SECRET");
|
||||
super({
|
||||
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
||||
secretOrKey: config.get("jwtSecret"),
|
||||
secretOrKey: config.get("JWT_SECRET"),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user