* Retrieve object of env variables. * @returns {object} with key: values as assembled in js/server_functions.js
()
| 23 | * @returns {object} with key: values as assembled in js/server_functions.js |
| 24 | */ |
| 25 | async function getEnvVars () { |
| 26 | // In test mode, skip server fetch and use config values directly |
| 27 | if (typeof process !== "undefined" && process.env && process.env.mmTestMode === "true") { |
| 28 | return getEnvVarsFromConfig(); |
| 29 | } |
| 30 | |
| 31 | // In production, fetch env vars from server |
| 32 | try { |
| 33 | const res = await fetch(new URL("env", `${location.origin}${config.basePath}`)); |
| 34 | return JSON.parse(await res.text()); |
| 35 | } catch (error) { |
| 36 | // Fallback to config values if server fetch fails |
| 37 | Log.error("Unable to retrieve env configuration", error); |
| 38 | return getEnvVarsFromConfig(); |
| 39 | } |
| 40 | } |
| 41 | |
| 42 | /** |
| 43 | * Loops through all modules and requests start for every module. |
no test coverage detected