dotenv 0.5.0.1 → 0.5.0.2
raw patch · 4 files changed
+32/−10 lines, 4 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGELOG.md +5/−0
- README.md +12/−5
- app/Main.hs +13/−4
- dotenv.cabal +2/−1
CHANGELOG.md view
@@ -1,4 +1,9 @@ ## MASTER+## Dotenv 0.5.0.2++* Set `.env` file as default file for environment variables.+* Add `--version` flag to check the version of dotenv that is in use.+ ## Dotenv 0.5.0.0 * Add [dotenv-safe functionality](https://www.npmjs.com/package/dotenv-safe)
README.md view
@@ -82,20 +82,27 @@ from one or more dotenv file before invoking an executable: ```shell-$ dotenv -e mydotenvfile myprogram+$ dotenv -f mydotenvfile myprogram ``` +The `-f` flag is optional, by default it looks for the `.env` file in the current+working directory.++```shell+$ dotenv myprogram+```+ Aditionally you can pass arguments and flags to the program passed to Dotenv: ```shell-$ dotenv -e mydotenvfile myprogram -- --myflag myargument+$ dotenv -f mydotenvfile myprogram -- --myflag myargument ``` or: ```shell-$ dotenv -e mydotenvfile "myprogram --myflag myargument"+$ dotenv -f mydotenvfile "myprogram --myflag myargument" ``` Also, you can use a `--example` flag to use [dotenv-safe functionality](https://www.npmjs.com/package/dotenv-safe)@@ -117,14 +124,14 @@ This will fail: ```shell-$ dotenv -e .env --example .env.example "myprogram --myflag myargument"+$ dotenv -f .env --example .env.example "myprogram --myflag myargument" > dotenv: Missing env vars! Please, check (this/these) var(s) (is/are) set: BAR ``` This will succeed: ```shell $ export BAR=123 # Or you can do something like: "echo 'BAR=123' >> .env"-$ dotenv -e .env --example .env.example "myprogram --myflag myargument"+$ dotenv -f .env --example .env.example "myprogram --myflag myargument" ``` Hint: The `env` program in most Unix-like environments prints out the
app/Main.hs view
@@ -3,16 +3,18 @@ module Main where +import Data.Version (showVersion) #if MIN_VERSION_optparse_applicative(0,13,0) import Data.Monoid ((<>)) #endif import Options.Applicative+import Paths_dotenv (version) import Control.Monad (void) import Configuration.Dotenv (loadFile)-import Configuration.Dotenv.Types (Config(..))+import Configuration.Dotenv.Types (Config(..), defaultConfig) import System.Process (system) import System.Exit (exitWith)@@ -31,18 +33,25 @@ void $ loadFile Config { configExamplePath = dotenvExampleFiles , configOverride = override- , configPath = dotenvFiles+ , configPath =+ if null dotenvFiles+ then configPath defaultConfig+ else dotenvFiles } system (program ++ concatMap (" " ++) args) >>= exitWith where- opts = info (helper <*> config)+ opts = info (helper <*> versionOption <*> config) ( fullDesc <> progDesc "Runs PROGRAM after loading options from FILE" <> header "dotenv - loads options from dotenv files" )+ versionOption =+ infoOption+ (showVersion version)+ (long "version" <> short 'v' <> help "Show version of the program") config :: Parser Options config = Options- <$> some (strOption (+ <$> many (strOption ( long "dotenv" <> short 'f' <> metavar "DOTENV"
dotenv.cabal view
@@ -1,5 +1,5 @@ name: dotenv-version: 0.5.0.1+version: 0.5.0.2 synopsis: Loads environment variables from dotenv files homepage: https://github.com/stackbuilders/dotenv-hs description:@@ -64,6 +64,7 @@ , process , text , transformers >=0.4 && < 0.6+ other-modules: Paths_dotenv hs-source-dirs: app if flag(dev)