Server IP : 150.95.80.236 / Your IP : 18.220.191.227 Web Server : Apache System : Linux host-150-95-80-236 3.10.0-1160.105.1.el7.x86_64 #1 SMP Thu Dec 7 15:39:45 UTC 2023 x86_64 User : social-telecare ( 10000) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/pcu.in.th/api-uat.pcu.in.th/node_modules/@nestjs/config/dist/ |
Upload File : |
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConditionalModule = void 0; const common_1 = require("@nestjs/common"); const config_module_1 = require("./config.module"); /** * @publicApi */ class ConditionalModule { /** * @publicApi */ static async registerWhen(module, condition, options) { let configResolved = false; const { timeout = 5000 } = options ?? {}; setTimeout(() => { if (!configResolved) { throw new Error(`Nest was not able to resolve the config variables within ${timeout} milliseconds. Bause of this, the ConditionalModule was not able to determine if ${module.toString()} should be registered or not`); } }, timeout); const returnModule = { module: ConditionalModule, imports: [], exports: [] }; if (typeof condition === 'string') { const key = condition; condition = env => { return env[key]?.toLowerCase() !== 'false'; }; } await config_module_1.ConfigModule.envVariablesLoaded; configResolved = true; const evaluation = condition(process.env); if (evaluation) { returnModule.imports.push(module); returnModule.exports.push(module); } else { common_1.Logger.debug(`${condition.toString()} evaluated to false. Skipping the registration of ${module.toString()}`, ConditionalModule.name); } return returnModule; } } exports.ConditionalModule = ConditionalModule;