Finally, I found a solution that seems to work. Just need to add these few lines to the Global
class:
class Global {
// --------------Add this lines-------------- //
@Expose({ name: 'APP_TAG' })
@Transform(({ obj }) =>
plainToInstance(Server, obj, { excludeExtraneousValues: true }),
)
// ------------------------------------------ //
@Type(() => Server)
server?: Server
// --------------Add this lines-------------- //
@Expose({ name: 'DATABASE_NAME' })
@Transform(({ obj }) =>
plainToInstance(Database, obj, { excludeExtraneousValues: true }),
)
// ------------------------------------------ //
@Type(() => Database)
database?: Database
}