0.1.1 • Published 2 years ago

@vitrify/plugin-env v0.1.1

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

@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'))
0.1.1

2 years ago

0.1.0

2 years ago

0.0.1

2 years ago