MCPcopy Create free account
hub / github.com/CloudOrc/SolidUI / loadEnvFile

Function loadEnvFile

solidui-web/scripts/start.js:90–107  ·  view source on GitHub ↗

* log env file * @param {*} envMode * @returns

(envMode)

Source from the content-addressed store, hash-verified

88 * @returns
89 */
90function loadEnvFile(envMode) {
91 const envFile = envConfig[envMode].envFile;
92 const needVariable = envConfig[envMode].needVariable;
93 // load
94 dotenv.config({ path: envFile, processEnv: process.env })
95 if (!checkFileExist([envFile]).status) Logger.logWarn(envFile + " does not exist, will Use default value \r\n more info please see https://github.com/CloudOrc/SolidUI/blob/dev/solidui-web/README.md")
96 function fillDefaultValue(envObject) {
97 for (let i = 0; i < needVariable.length; i++) {
98 const variable = needVariable[i];
99 if (envObject[variable.name] === void 0) {
100 envObject[variable.name] = variable.default
101 }
102 }
103 }
104 fillDefaultValue(process.env)
105 const missVariable = verifyEnv(needVariable.map(v => v.name), process.env)
106 if (missVariable.length) exitProcess(`please check it ${envFile}, ${missVariable.join(',')} miss`)
107}
108
109/**
110 * build pre check

Callers 1

mainFunction · 0.85

Calls 5

checkFileExistFunction · 0.85
fillDefaultValueFunction · 0.85
verifyEnvFunction · 0.85
exitProcessFunction · 0.85
logWarnMethod · 0.80

Tested by

no test coverage detected