backend: Adds the edition to the app's name

Includes the edition of the application in logs and display to differentiate builds.

Adds a script to `package.json` to allow for watching build.
This commit is contained in:
Carlos Santos 2025-10-16 17:57:53 +02:00
parent faa5934a17
commit edb9b43219
4 changed files with 8 additions and 6 deletions

View File

@ -28,6 +28,7 @@
], ],
"scripts": { "scripts": {
"build": "tsc -p tsconfig.prod.json", "build": "tsc -p tsconfig.prod.json",
"build:watch": "tsc -p tsconfig.prod.json --watch",
"doc:api": "mkdir -p public/openapi && cd openapi && openapi-generate-html -i openvidu-meet-api.yaml --ui=stoplight --theme=light --title 'OpenVidu Meet REST API' --description 'OpenVidu Meet REST API' -o ../public/openapi/public.html", "doc:api": "mkdir -p public/openapi && cd openapi && openapi-generate-html -i openvidu-meet-api.yaml --ui=stoplight --theme=light --title 'OpenVidu Meet REST API' --description 'OpenVidu Meet REST API' -o ../public/openapi/public.html",
"doc:internal-api": "mkdir -p public/openapi && cd openapi && openapi-generate-html -i openvidu-meet-internal-api.yaml --ui=stoplight --theme=dark --title 'OpenVidu Meet Internal REST API' --description 'OpenVidu Meet Internal REST API' -o ../public/openapi/internal.html", "doc:internal-api": "mkdir -p public/openapi && cd openapi && openapi-generate-html -i openvidu-meet-internal-api.yaml --ui=stoplight --theme=dark --title 'OpenVidu Meet Internal REST API' --description 'OpenVidu Meet Internal REST API' -o ../public/openapi/internal.html",
"start": "node dist/src/server.js", "start": "node dist/src/server.js",

View File

@ -21,6 +21,7 @@ export const {
MEET_LOG_LEVEL = 'info', MEET_LOG_LEVEL = 'info',
MEET_NAME_ID = 'openviduMeet', MEET_NAME_ID = 'openviduMeet',
MEET_BASE_URL = '', MEET_BASE_URL = '',
MEET_EDITION = 'CE',
/** /**
* Authentication configuration * Authentication configuration
@ -102,7 +103,7 @@ export const logEnvVars = () => {
console.log(' '); console.log(' ');
console.log('---------------------------------------------------------'); console.log('---------------------------------------------------------');
console.log('OpenVidu Meet Server Configuration'); console.log(`OpenVidu Meet ${MEET_EDITION} Server Configuration`);
console.log('---------------------------------------------------------'); console.log('---------------------------------------------------------');
console.log('SERVICE NAME ID: ', text(MEET_NAME_ID)); console.log('SERVICE NAME ID: ', text(MEET_NAME_ID));
console.log('CORS ORIGIN:', text(SERVER_CORS_ORIGIN)); console.log('CORS ORIGIN:', text(SERVER_CORS_ORIGIN));

View File

@ -4,7 +4,7 @@ import cors from 'cors';
import express, { Express, Request, Response } from 'express'; import express, { Express, Request, Response } from 'express';
import { initializeEagerServices, registerDependencies } from './config/index.js'; import { initializeEagerServices, registerDependencies } from './config/index.js';
import { INTERNAL_CONFIG } from './config/internal-config.js'; import { INTERNAL_CONFIG } from './config/internal-config.js';
import { SERVER_CORS_ORIGIN, SERVER_PORT, logEnvVars } from './environment.js'; import { MEET_EDITION, SERVER_CORS_ORIGIN, SERVER_PORT, logEnvVars } from './environment.js';
import { httpContextMiddleware, jsonSyntaxErrorHandler } from './middlewares/index.js'; import { httpContextMiddleware, jsonSyntaxErrorHandler } from './middlewares/index.js';
import { import {
authRouter, authRouter,
@ -94,7 +94,7 @@ const startServer = (app: express.Application) => {
console.log(' '); console.log(' ');
console.log('---------------------------------------------------------'); console.log('---------------------------------------------------------');
console.log(' '); console.log(' ');
console.log('OpenVidu Meet is listening on port', chalk.cyanBright(SERVER_PORT)); console.log(`OpenVidu Meet ${MEET_EDITION} is listening on port`, chalk.cyanBright(SERVER_PORT));
console.log( console.log(
'REST API Docs: ', 'REST API Docs: ',
chalk.cyanBright(`http://localhost:${SERVER_PORT}${INTERNAL_CONFIG.API_BASE_PATH_V1}/docs`) chalk.cyanBright(`http://localhost:${SERVER_PORT}${INTERNAL_CONFIG.API_BASE_PATH_V1}/docs`)

View File

@ -1,6 +1,6 @@
import { injectable } from 'inversify'; import { injectable } from 'inversify';
import winston from 'winston'; import winston from 'winston';
import { MEET_LOG_LEVEL } from '../environment.js'; import { MEET_EDITION, MEET_LOG_LEVEL } from '../environment.js';
@injectable() @injectable()
export class LoggerService { export class LoggerService {
@ -20,7 +20,7 @@ export class LoggerService {
? JSON.stringify(info.metadata) ? JSON.stringify(info.metadata)
: '' : ''
: ''; : '';
return `${info.timestamp} [${info.level}] ${info.message} ${meta}`; return `${info.timestamp} | ${MEET_EDITION} | [${info.level}] ${info.message} ${meta}`;
// return `${info.timestamp} [${info.level}] ${info.message}`; // return `${info.timestamp} [${info.level}] ${info.message}`;
}), }),
@ -41,7 +41,7 @@ export class LoggerService {
? JSON.stringify(info.metadata) ? JSON.stringify(info.metadata)
: '' : ''
: ''; : '';
return `${info.timestamp} [${info.level}] ${info.message} ${meta}`; return `${info.timestamp} | ${MEET_EDITION} | [${info.level}] ${info.message} ${meta}`;
// return `${info.timestamp} [${info.level}] ${info.message}`; // return `${info.timestamp} [${info.level}] ${info.message}`;
}) })