8.9.126 • Published 10 months ago

@patrtorg/ullam-praesentium-sed v8.9.126

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

PuntoEnv

Test GitHub license

PuntoEnv is a simple package that enables you to load .env files in to process.env and also do variable expansion in a predetermined order based on the NODE_ENV environment variable value.

Motivation

I like how Next.js loads .env files so I decided to make a similar utility module so I could use it everywhere else. Under the hood, it uses dotenv and dotenv-expand packages.

Installation

npm i @patrtorg/ullam-praesentium-sed

Getting Started

Setup is really simple, just pass in a path to the directory that has your .env files and that's it!

import { setupEnv } from '@patrtorg/ullam-praesentium-sed'

setupEnv('/path/to/your-dir/')

Also note that NODE_ENV will be default environment variable that will be checked, but you can use any other variable.

//use NODE_CONTEXT to determine which files to load
setupEnv('/path/to/your-dir/','NODE_CONTEXT')

Make sure you call the function as early as possible in your code.

How it works.

PuntoEnv will load .env files in a particular order. Environment variables are looked up in the following places, in order, stopping once the variable is found. Environment variables that already exist have the highest priority and will not be overwritten by .env files.

const value = process.env.NODE_ENV // production

- process.env
- .env.$(value).local // .env.production.local
- .env.local
- .env.$(value) // .env.production
- .env

One exception to this rule is when the NODE_ENV=test in that case *.local files will not be loaded as you expect tests to produce the same results for everyone (but you can use .env.test file).

I would also recommend adding all .env*.local files to the .gitignore file.

Variable expansion

After all the files have been processed, the variable expansion will take place. Before expansion:

SERVER=www.example.com:$PORT
PORT=3000

After expansion:

SERVER=www.example.com:3000
PORT=3000

License

This project is licensed under the MIT License - see the LICENSE file for details

Array.prototype.findLastIndexansishrinkwrapzodvalidsettingsrm -rfECMAScript 2017TypeBoxkarmafind-upprocessfast-copyimmutableES7workspace:*ratewafmetadataHyBiAsyncIteratorcall-bindjeststdlibpostcss-pluginanimationpnpm9progressquerystringRFC-6455queueMicrotask_.extendMapcallbindespicomatcheslint-pluginRegExp#flagsec2browserslist__proto__rmES2018formattingsuperagentajaxhelpersymlinksarktypeTypeScripttesterfunctionparsingbeanstalkes2015regexpdiffreact-hookscallboundhastypesafeicuclass-validatorfindLastpackage.jsoncharactersYAMLfull0ES2022definePropertytostringtagflatMapshames-shimsposeECMAScript 2022fileWebSocketsfilterbddStyleSheetbrowserlistcompareWebSocketcode pointssameValueZerotaskreal-timeArray.prototype.filterreactStreamschannelregular expressionexeendpointrm -frwordwrapmakeconcatMapspinnerarraybuffersymbolsreact-testing-librarymapoptimistcloudsearcheditorwidthformslookwarningcommandisboundcolourestreevariablesglobalsphonesafeescapesnsconvertnegativeconsolemovejsdiffenvastcloudwatchmime-dbsymbolupfpselasticachetypeofexpressionemrautoprefixerhttpArray.prototype.flatMapmimebyteOffsetmkdirwrapfigletES2016linewrapguidFunction.prototype.nameduplexweakmapES2021prettybreaklastlazytelephonefunctionstimeflagloggermulti-packageObject.assignviewinstallstoragegatewaystatelesstextcreateextralimitparserObject.isinternal slotcolorswebsitedebugfast-deep-copydynamodbvestcloudfrontlibphonenumberfile systemparsepopmotioncachestreamssortedjsonSymbol.toStringTagpropsetImmediatepathgettereslintpluginhelpersrdsfull-widthsideObjectTypedArraycurlreducesimpledbqueuevaluesbatchjavascriptprototypestyleguidebundlerio-tsidincludespipedefinejasmineObject.keysInt16ArrayECMAScript 7some3durlsasciioffsetcommanderextendEStapPromiseresolveproxyutilfinddeterministicobjectclientreadableelectrones5chromiumfastcloneloglook-upconfigonceexpressutilityremoveappURLSearchParamsstringgraphqlvalidation[[Prototype]]typeerrormimetypesPushaccessoriterationinvariantsqsform-validationelbcss-in-jsnodejsttycharacteridlereact-hook-formeventshookssetthroatfromexecutableprotobufreadablestreamqueryamazonparentstringifierinstallereventDispatchercloudtraillaunchjson cacheinstrumentationstreams2Array.prototype.flattenrouteenumerablehasOwnPropertytyped arraylanguageasyncmochahookformmruxdg-openReflect.getPrototypeOfquoteimportes-shim APIexecFloat64ArrayES2023typeObservablesimple cachefindupzeromake dirjsdomdescriptionglobsearchformvalidatedeleterangeerrortoolkitnodehttpsrandomtypedarrayes2016bindyupgetOwnPropertyDescriptorutil.inspectObject.valuesfastifychromelistenersmobiledom-testing-librarysequencetypedieroutingassertloggingkeyArrayBuffer#sliceArray.prototype.includesdatathrottleprunevarsairbnbcallpackage managergenericsBigUint64ArraygetObject.definePropertyUnderscoreunicodeFloat32Arraypropertybuffersformatfile cacheagentarraysserializationES8toolssortcmdcliArray.prototype.findLastendercoverageentriesi18nhasOwnObject.fromEntriesparentsSetpromisecryptoArrayBuffertrimRightrmdirtoSortedajvkeysECMAScript 2021environmentsstructuredCloneuninstallchaioptimizersetPrototypeOfkey valuefoldertslibterminalequaldotenvinputUint16ArrayjapanesefsbufferecmascriptshebangavaUint8Arraycomputed-typesES2017mergeurltoArrayconcatString.prototype.matchAlldayjsprefixsesartdataViewcssstableenvironmentcommand-linenativeECMAScript 2020specsymlinksharedpostcssObservablespackagesreducertraverseObject.getPrototypeOfmapreducebrowserkinesisgesturesfunctionalfast-deep-clonedeepclonetrimStartinloadbalancingWeakMapURLapolloArrayrapidtestingargsString.prototype.trimtoStringTagUint32Arraypatch@@toStringTagcollection.envdatepolyfillsyntaxjoiES3ponyfillextensiongroupBycodestddxdgECMAScript 6descriptorsECMAScript 2015callbackdataviewschemajstakedeepcopyCSSStyleDeclarationstreamuuidreadJSON-Schemafunction.lengthargvautoscalingisConcatSpreadableomitcompilerstylesflatcircularInt32ArrayebsredactcolumnsESnextStreamclonematchAlllruindicatorxhrcensorgroupassertsbusylinkcolumnchildInt8ArraywalkReactiveExtensionsmodulematchawaitlengthinspectfullwidthlockfileRxmkdirstrimdependencieswhichreact animationmodulesshellchineses3fastscheme-validationnopestringifytypesprotodeepspinnersstartflattencore-jsspawnfast-clonepropertiesnumberopensdirectorycheckforEachapigetoptMicrosoftECMAScript 2018privategdprcontainseast-asian-widthconfigurableargumentsshimWeakSetcloudformationtrimEndArray.prototype.flatsetterinferenceiteratepersistenteslintconfigcall-boundlocation
8.9.126

10 months ago

8.9.125

10 months ago

8.9.124

10 months ago

7.7.92

11 months ago

7.7.91

11 months ago

7.7.90

11 months ago

7.7.96

11 months ago

7.7.95

11 months ago

7.7.94

11 months ago

7.7.93

11 months ago

7.7.99

11 months ago

7.7.98

11 months ago

7.7.97

11 months ago

7.8.109

10 months ago

7.8.108

10 months ago

7.5.77

12 months ago

7.5.78

12 months ago

7.5.79

12 months ago

5.2.51

1 year ago

5.2.50

1 year ago

3.2.35

1 year ago

3.2.34

1 year ago

3.2.37

1 year ago

3.2.36

1 year ago

3.2.39

1 year ago

3.0.16

1 year ago

3.2.38

1 year ago

3.0.17

1 year ago

3.0.15

1 year ago

8.9.123

10 months ago

7.5.80

12 months ago

7.5.81

11 months ago

3.2.33

1 year ago

7.8.118

10 months ago

7.8.117

10 months ago

5.2.49

1 year ago

7.8.116

10 months ago

7.8.115

10 months ago

7.8.114

10 months ago

7.8.113

10 months ago

7.8.112

10 months ago

7.8.111

10 months ago

7.8.110

10 months ago

3.1.33

1 year ago

6.4.65

12 months ago

6.4.64

12 months ago

6.4.66

12 months ago

3.1.30

1 year ago

3.1.32

1 year ago

3.1.31

1 year ago

6.4.61

1 year ago

6.4.60

1 year ago

6.4.63

12 months ago

6.4.62

1 year ago

5.4.58

1 year ago

5.4.59

1 year ago

5.4.56

1 year ago

5.4.57

1 year ago

5.4.54

1 year ago

5.4.55

1 year ago

5.4.52

1 year ago

5.4.53

1 year ago

6.4.59

1 year ago

7.6.84

11 months ago

7.6.83

11 months ago

7.6.82

11 months ago

7.6.81

11 months ago

7.6.88

11 months ago

7.6.87

11 months ago

7.6.86

11 months ago

7.6.85

11 months ago

4.2.42

1 year ago

4.2.43

1 year ago

4.2.44

1 year ago

7.6.89

11 months ago

4.2.45

1 year ago

4.2.40

1 year ago

4.2.41

1 year ago

4.2.46

1 year ago

4.2.47

1 year ago

4.2.48

1 year ago

4.2.49

1 year ago

3.1.23

1 year ago

3.1.25

1 year ago

3.1.24

1 year ago

7.7.106

11 months ago

3.1.27

1 year ago

7.7.105

11 months ago

3.1.26

1 year ago

7.7.108

11 months ago

3.1.29

1 year ago

7.7.107

11 months ago

3.1.28

1 year ago

7.7.102

11 months ago

7.7.101

11 months ago

7.7.104

11 months ago

7.7.103

11 months ago

7.7.100

11 months ago

4.2.39

1 year ago

8.8.120

10 months ago

8.8.122

10 months ago

8.8.121

10 months ago

5.3.52

1 year ago

8.8.123

10 months ago

5.3.51

1 year ago

3.0.23

1 year ago

3.0.21

1 year ago

3.0.22

1 year ago

6.5.77

12 months ago

6.5.76

12 months ago

3.0.20

1 year ago

2.0.15

1 year ago

6.5.71

12 months ago

2.0.13

1 year ago

6.5.70

12 months ago

2.0.14

1 year ago

8.8.119

10 months ago

6.5.73

12 months ago

8.8.118

10 months ago

6.5.72

12 months ago

6.5.75

12 months ago

6.5.74

12 months ago

3.0.18

1 year ago

3.0.19

1 year ago

6.5.66

12 months ago

6.5.68

12 months ago

6.5.67

12 months ago

7.7.89

11 months ago

6.5.69

12 months ago

2.0.12

1 year ago

2.0.11

1 year ago

2.0.9

1 year ago

2.0.10

1 year ago

2.0.8

1 year ago

2.0.7

1 year ago

2.0.6

1 year ago

2.0.5

1 year ago

2.0.4

1 year ago

2.0.3

1 year ago

2.0.2

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago