Server IP : 150.95.80.236 / Your IP : 18.119.158.4 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"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var ConfigModule_1; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConfigModule = void 0; const common_1 = require("@nestjs/common"); const shared_utils_1 = require("@nestjs/common/utils/shared.utils"); const dotenv = __importStar(require("dotenv")); const dotenv_expand_1 = require("dotenv-expand"); const fs = __importStar(require("fs")); const path_1 = require("path"); const config_host_module_1 = require("./config-host.module"); const config_constants_1 = require("./config.constants"); const config_service_1 = require("./config.service"); const create_config_factory_util_1 = require("./utils/create-config-factory.util"); const get_registration_token_util_1 = require("./utils/get-registration-token.util"); const merge_configs_util_1 = require("./utils/merge-configs.util"); let ConfigModule = exports.ConfigModule = ConfigModule_1 = class ConfigModule { /** * This promise resolves when "dotenv" completes loading environment variables. * When "ignoreEnvFile" is set to true, then it will resolve immediately after the * "ConfigModule#forRoot" method is called. */ static get envVariablesLoaded() { return this._envVariablesLoaded; } /** * Loads process environment variables depending on the "ignoreEnvFile" flag and "envFilePath" value. * Also, registers custom configurations globally. * @param options */ static forRoot(options = {}) { let validatedEnvConfig = undefined; let config = options.ignoreEnvFile ? {} : this.loadEnvFile(options); if (!options.ignoreEnvVars) { config = { ...config, ...process.env, }; } if (options.validate) { const validatedConfig = options.validate(config); validatedEnvConfig = validatedConfig; this.assignVariablesToProcess(validatedConfig); } else if (options.validationSchema) { const validationOptions = this.getSchemaValidationOptions(options); const { error, value: validatedConfig } = options.validationSchema.validate(config, validationOptions); if (error) { throw new Error(`Config validation error: ${error.message}`); } validatedEnvConfig = validatedConfig; this.assignVariablesToProcess(validatedConfig); } else { this.assignVariablesToProcess(config); } const isConfigToLoad = options.load && options.load.length; const providers = (options.load || []) .map(factory => (0, create_config_factory_util_1.createConfigProvider)(factory)) .filter(item => item); const configProviderTokens = providers.map(item => item.provide); const configServiceProvider = { provide: config_service_1.ConfigService, useFactory: (configService) => { if (options.cache) { configService.isCacheEnabled = true; } return configService; }, inject: [config_constants_1.CONFIGURATION_SERVICE_TOKEN, ...configProviderTokens], }; providers.push(configServiceProvider); if (validatedEnvConfig) { const validatedEnvConfigLoader = { provide: config_constants_1.VALIDATED_ENV_LOADER, useFactory: (host) => { host[config_constants_1.VALIDATED_ENV_PROPNAME] = validatedEnvConfig; }, inject: [config_constants_1.CONFIGURATION_TOKEN], }; providers.push(validatedEnvConfigLoader); } this.environmentVariablesLoadedSignal(); return { module: ConfigModule_1, global: options.isGlobal, providers: isConfigToLoad ? [ ...providers, { provide: config_constants_1.CONFIGURATION_LOADER, useFactory: (host, ...configurations) => { configurations.forEach((item, index) => this.mergePartial(host, item, providers[index])); }, inject: [config_constants_1.CONFIGURATION_TOKEN, ...configProviderTokens], }, ] : providers, exports: [config_service_1.ConfigService, ...configProviderTokens], }; } /** * Registers configuration object (partial registration). * @param config */ static forFeature(config) { const configProvider = (0, create_config_factory_util_1.createConfigProvider)(config); const serviceProvider = { provide: config_service_1.ConfigService, useFactory: (configService) => configService, inject: [config_constants_1.CONFIGURATION_SERVICE_TOKEN, configProvider.provide], }; return { module: ConfigModule_1, providers: [ configProvider, serviceProvider, { provide: config_constants_1.CONFIGURATION_LOADER, useFactory: (host, partialConfig) => { this.mergePartial(host, partialConfig, configProvider); }, inject: [config_constants_1.CONFIGURATION_TOKEN, configProvider.provide], }, ], exports: [config_service_1.ConfigService, configProvider.provide], }; } static loadEnvFile(options) { const envFilePaths = Array.isArray(options.envFilePath) ? options.envFilePath : [options.envFilePath || (0, path_1.resolve)(process.cwd(), '.env')]; let config = {}; for (const envFilePath of envFilePaths) { if (fs.existsSync(envFilePath)) { config = Object.assign(dotenv.parse(fs.readFileSync(envFilePath)), config); if (options.expandVariables) { const expandOptions = typeof options.expandVariables === 'object' ? options.expandVariables : {}; config = (0, dotenv_expand_1.expand)({ ...expandOptions, parsed: config }).parsed || config; } } } return config; } static assignVariablesToProcess(config) { if (!(0, shared_utils_1.isObject)(config)) { return; } const keys = Object.keys(config).filter(key => !(key in process.env)); keys.forEach(key => { const value = config[key]; if (typeof value === 'string') { process.env[key] = value; } else if (typeof value === 'boolean' || typeof value === 'number') { process.env[key] = `${value}`; } }); } static mergePartial(host, item, provider) { const factoryRef = provider.useFactory; const token = (0, get_registration_token_util_1.getRegistrationToken)(factoryRef); (0, merge_configs_util_1.mergeConfigObject)(host, item, token); } static getSchemaValidationOptions(options) { if (options.validationOptions) { if (typeof options.validationOptions.allowUnknown === 'undefined') { options.validationOptions.allowUnknown = true; } return options.validationOptions; } return { abortEarly: false, allowUnknown: true, }; } }; ConfigModule._envVariablesLoaded = new Promise(resolve => (ConfigModule_1.environmentVariablesLoadedSignal = resolve)); exports.ConfigModule = ConfigModule = ConfigModule_1 = __decorate([ (0, common_1.Module)({ imports: [config_host_module_1.ConfigHostModule], providers: [ { provide: config_service_1.ConfigService, useExisting: config_constants_1.CONFIGURATION_SERVICE_TOKEN, }, ], exports: [config_host_module_1.ConfigHostModule, config_service_1.ConfigService], }) ], ConfigModule);