Patch
This commit is contained in:
@@ -9,7 +9,7 @@ import { Project, ProjectSchema } from "./schemas/project.schema.js";
|
||||
import { Function, FunctionSchema } from "./schemas/function.schema.js";
|
||||
import { JwtModule } from "@nestjs/jwt";
|
||||
import { BcryptService } from "./services/bcrypt.service.js";
|
||||
import { JWT_SECRET } from "./auth/const.js";
|
||||
import { JWT_SECRET, MONGO_URL } from "./auth/const.js";
|
||||
import { AuthController } from "./controllers/auth.controller.js";
|
||||
import { JwtStrategy } from "./auth/jwt.strategy.js";
|
||||
import { LocalStrategy } from "./auth/local.strategy.js";
|
||||
@@ -33,9 +33,7 @@ import { HealthController } from "./controllers/health.controller.js";
|
||||
secret: JWT_SECRET,
|
||||
signOptions: { expiresIn: "3600s" },
|
||||
}),
|
||||
MongooseModule.forRoot(
|
||||
process.env.MONGO_URL ?? "mongodb://sigma:supersecret@localhost:27017"
|
||||
),
|
||||
MongooseModule.forRoot(MONGO_URL),
|
||||
MongooseModule.forFeature([
|
||||
{
|
||||
name: User.name,
|
||||
|
||||
@@ -1 +1,11 @@
|
||||
export const JWT_SECRET = process.env["JWT_SECRET"] ?? "supersecret";
|
||||
function getRequiredEnv(name: string): string {
|
||||
const value = process.env[name];
|
||||
if (!value) {
|
||||
throw new Error(`${name} environment variable must be set`);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
export const JWT_SECRET = getRequiredEnv("JWT_SECRET");
|
||||
export const MONGO_URL = getRequiredEnv("MONGO_URL");
|
||||
|
||||
@@ -86,7 +86,7 @@ export class FunctionsService {
|
||||
});
|
||||
|
||||
if (func) {
|
||||
await this.projectModel.findByIdAndUpdate(func._id, {
|
||||
await this.projectModel.findByIdAndUpdate(func.project, {
|
||||
$inc: {
|
||||
functionsInvocationCount: 1,
|
||||
functionsErrorCount: successful ? 0 : 1,
|
||||
|
||||
@@ -15,7 +15,9 @@ async function bootstrap() {
|
||||
app.set("query parser", "extended");
|
||||
app.useGlobalPipes(
|
||||
new ValidationPipe({
|
||||
whitelist: false,
|
||||
whitelist: true,
|
||||
forbidNonWhitelisted: true,
|
||||
transform: true,
|
||||
})
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user