![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/ts.corals.io/frontend/node_modules/@nuxtjs/dotenv/lib/ |
const { readFileSync, accessSync, constants } = require('fs') const { join } = require('path') const { parse } = require('dotenv') const logger = require('./logger') module.exports = function (moduleOptions) { const options = { only: null, path: this.options.srcDir, filename: '.env', systemvars: false, ...this.options.dotenv, ...moduleOptions } const envFilePath = join(options.path, options.filename) try { accessSync(envFilePath, constants.R_OK) } catch (err) { logger.warn(`No \`${options.filename}\` file found in \`${options.path}\`.`) return } const envConfig = parse(readFileSync(envFilePath)) if (options.systemvars) { Object.keys(process.env).map((key) => { if (!(key in envConfig)) { envConfig[key] = process.env[key] } }) } Object.keys(envConfig).forEach((key) => { if (!Array.isArray(options.only) || options.only.includes(key)) { this.options.env[key] = this.options.env[key] || envConfig[key] } }) } module.exports.meta = require('../package.json')