Skip to content

v2.0.0

Compare
Choose a tag to compare
@rogusdev rogusdev released this 16 Dec 03:16
· 108 commits to master since this release
a336773

This version has many breaking changes! Most of them will probably not bite you, but you should test.

  • Completely replace previous parsing logic with all new using Monadic Parser Combinators via Sprache which enables many of the rest of these changes, and should be much more robust -- and more consistent with other dotenv libraries (i.e. reuse dotenv files, hopefully, or more easily, at least -- there is a widespread lack of consistency here).
  • Changes the rules for quoted strings: single and double quotes behave differently from each other and before, notably allowing multiline strings -- but removing interpolation from single quoted strings
  • Changes the rules for unquoted strings: trim whitespace is effectively always on and no whitespace is allowed inside such unquoted strings (although you can interpolated variables here, which themselves could have whitespace in their values)
  • Allow for hash chars inside quoted values (and unquoted, as it happens)
  • Allow for multiline quoted values (e.g. MULTILINE="line1 ... line2 ... line3 ... etc" across multiple lines in a single .env file within a single pair of quotes)
  • Parse variables in the ${ENVVAR} form in addition to $ENVVAR
  • Allow for lines to start with export (and other such env var setting commands) to allow for .env files to be directly source-d in a terminal
  • Add a new return value from Load that has all the keys and values set in an IEnumerable<KeyValuePair<string, string>> -- including duplicate keys, so an extension ToDictionary() method is also included to convert that enumerable into a unique key dictionary for configuration loading
  • Add fluent methods to turn off options for Load -- and remove all old options related to parsing, leaving only clobberExistingVars, while adding setEnvVars and onlyExactPath for disabling side effects (setting env vars) and traversing up the path to find an .env file, respectively