1.0.3 • Published 5 years ago

@lds/universal-env v1.0.3

Weekly downloads
138
License
MIT
Repository
-
Last release
5 years ago

Universal Environment Variables

Safe, universal environment variables in 3 easy steps 😬.

1. Define what to share

Do this early in the application's lifecycle.

import { share } from "@lds/universal-env";

share("NODE_ENV", "GRAPHQL_ENDPOINT");

2. Populate a script tag in the document template

Add as script tag when generating the document. The script function returns a string of javascript.

import { script } from "@lds/universal-env";
<script>{script()}</script>

3. Access shared variables.

import { get } from "@lds/universal-env";

const { NODE_ENV, GRAPHQL_ENDPOINT } = get();
1.0.3

5 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago