on master help sign in
Merge branch 'entrypoint' of https://github.com/kseo/docker-hs into entrypoint
commit2cfedd088b0017e2100d5cfce08621f409691955 authorDeni Bertovic <deni@denibertovic.com> dateTue 21 Mar 2017, 00:07 (10 years ago) parent6a723e3f73e3ba
1 file changed+6−4
src/Docker/Client/Types.hs+6−4
src/Docker/Client/Types.hs+6−4
@@ -96,6 +96,7 @@ import Data.Aeson (FromJSON, ToJSON, genericParseJSON,
9696import qualified Data.Aeson as JSON
9797import Data.Aeson.Types (defaultOptions, fieldLabelModifier)
9898import Data.Char (isAlphaNum, toUpper)
99+import Data.Foldable (asum)
99100import qualified Data.HashMap.Strict as HM
100101import Data.Monoid ((<>))
101102import Data.Scientific (floatingOrInteger)
@@ -643,7 +644,7 @@ defaultContainerConfig imageName = ContainerConfig {
643644 , cmd=[]
644645 , volumes=[]
645646 , workingDir=Nothing
646− , entrypoint=Nothing
647+ , entrypoint=[]
647648 , networkDisabled=Nothing
648649 , macAddress=Nothing
649650 , labels=[]
@@ -1404,7 +1405,7 @@ data ContainerConfig = ContainerConfig {
14041405 , image :: Text
14051406 , volumes :: [Volume]
14061407 , workingDir :: Maybe FilePath
1407− , entrypoint :: Maybe Text -- Can be null?
1408+ , entrypoint :: [Text]
14081409 , networkDisabled :: Maybe Bool -- Note: Should we expand the JSON instance and take away the Maybe? Null is False?
14091410 , macAddress :: Maybe Text
14101411 -- , onBuild :: Maybe Text -- For 1.24, only see this in the inspect response.
@@ -1433,7 +1434,9 @@ instance FromJSON ContainerConfig where
14331434 image <- o .: "Image"
14341435 volumes <- o .: "Volumes"
14351436 workingDir <- o .:? "WorkingDir"
1436− entrypoint <- o .:? "Entrypoint"
1437+ entrypoint <- asum [ o .:? "Entrypoint" .!= []
1438+ , (:[]) <$> o .: "Entrypoint"
1439+ ]
14371440 networkDisabled <- o .:? "networkDisabled"
14381441 macAddress <- o .:? "MacAddress"
14391442 labels <- o .:? "Labels" .!= []
@@ -1464,4 +1467,3 @@ toJsonKeyVal vs getKey getVal = JSON.Object $ foldl f HM.empty vs
14641467-- | Helper function that return an empty dictionary "{}"
14651468emptyJsonObject :: JSON.Value
14661469emptyJsonObject = JSON.Object HM.empty
1467−