@vitrify/plugin-env
v0.1.1
Published
Isomorphic environment variable retrieval.
Downloads
3
Readme
@vitrify/plugin-env
Isomorphic environment variable retrieval.
Reads your environment variable in this order:
import.meta.env[envVar]
process.env[envVar]
If the environment variable contains a Docker secret path:/run/secrets/[envVar]
/run/secrets/[envVar + '_FILE']
Usage
In vite.config or vitrify.config:
import envPlugin from '@vitrify/plugin-env'
...
plugins: [
envPlugin()
]
In a JS file:
import env from 'virtual:env'
console.log(env.read('MY_ENV_VAR'))