import{readEnvVariable as i}from"../utils/envs/read-env-variable.js";import{envSchema as r}from"./env-schema.js";function O(){const o=Object.fromEntries(Object.keys(process.env).map(n=>[n,i(n)]));o.REDOCLY_EXECUTION_MODE=process.env.REDOCLY_EXECUTION_MODE,o.REDOCLY_INTERNAL_DEV=process.env.REDOCLY_INTERNAL_DEV,o.REDOCLY_PORTAL_VERSION=process.env.REDOCLY_PORTAL_VERSION;const e=r.parse(o);return{...e,isProductionEnv:e.REDOCLY_ENV==="production",isPreviewEnv:e.REDOCLY_ENV==="preview",isReunite:["production","preview"].includes(e.REDOCLY_ENV)||e.REDOCLY_ENV==="development"&&!e.REDOCLY_INTERNAL_DEV&&!!e.ORGANIZATION_ID,isBuildMode:e.REDOCLY_EXECUTION_MODE==="build",isDevelopMode:e.REDOCLY_EXECUTION_MODE==="develop",isRuntimeMode:e.REDOCLY_EXECUTION_MODE==="runtime"}}const E=O();function c(){const o=O();for(const e of Object.keys(E))delete E[e];Object.assign(E,o)}function R(o,e){const n=typeof o=="string"?{[o]:e}:o;for(const[s,t]of Object.entries(n))t==null?delete process.env[s]:process.env[s]=t;c()}export{E as envConfig,c as reloadEnvConfig,R as setEnv};
