Add production deployment guide and restrict CORS to development.

Document clearnet, TLS, and Tor setup; enable Nest CORS only in development and skip CORS_ORIGINS validation in production.
This commit is contained in:
2026-10-28 22:07:32 +01:00
parent 915d62f09a
commit 4a534a8007
5 changed files with 155 additions and 5 deletions
+8 -4
View File
@@ -8,6 +8,7 @@ import { altchaMiddleware } from './middlewares/altchaMiddleware';
import { AltchaService } from './modules/altcha/services/AltchaService';
import { Config } from './types/config/Config';
import { HttpMethod } from './types/HttpMethod';
import { NodeEnv } from './types/NodeEnv';
async function bootstrap() {
const app = await NestFactory.create<NestExpressApplication>(AppModule, { bodyParser: false });
@@ -21,6 +22,7 @@ async function bootstrap() {
const {
port,
nodeEnv,
corsOrigins,
validation: {
upload: { maxRequestBodyBytes }
@@ -52,10 +54,12 @@ async function bootstrap() {
})
);
app.enableCors({
origin: corsOrigins,
credentials: true
});
if (nodeEnv === NodeEnv.Development) {
app.enableCors({
origin: corsOrigins,
credentials: true
});
}
app.set('trust proxy', 1);