Interpolate boolean env vars from conf file (#897)

This commit is contained in:
Joe Nelson
2017-06-25 23:30:23 -05:00
committed by GitHub
parent b007428142
commit 7cc38330a8
2 changed files with 8 additions and 1 deletions
+2
View File
@@ -11,6 +11,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- #896, Boolean env var interpolation in config file - @begriffs
## [0.4.2.0] - 2017-06-11
### Added
+6 -1
View File
@@ -111,7 +111,7 @@ readOptions = do
<*> (fromMaybe "*4" <$> C.key "server-host")
<*> (fromMaybe 3000 . join . fmap coerceInt <$> C.key "server-port")
<*> (fmap encodeUtf8 . mfilter (/= "") <$> C.key "jwt-secret")
<*> (fromMaybe False <$> C.key "secret-is-base64")
<*> (fromMaybe False . join . fmap coerceBool <$> C.key "secret-is-base64")
<*> (fromMaybe 10 . join . fmap coerceInt <$> C.key "db-pool")
<*> (join . fmap coerceInt <$> C.key "max-rows")
<*> C.key "pre-request"
@@ -130,6 +130,11 @@ readOptions = do
coerceInt (String x) = readMaybe $ toS x
coerceInt _ = Nothing
coerceBool :: Value -> Maybe Bool
coerceBool (Bool b) = Just b
coerceBool (String x) = readMaybe $ toS x
coerceBool _ = Nothing
opts = info (helper <*> pathParser) $
fullDesc
<> progDesc (