on master help sign in
amended JSON serialization of port bindings to conform to the documentation
commit0956dc7b73d27f4ef61ca797c50bbbd197ae76e1 authorHumane Software <irek@humane-software.com> dateWed 17 Dec 2014, 13:27 (12 years ago) parenta68d6a1
1 file changed+2−2
Network/Docker/Types.hs+2−2
Network/Docker/Types.hs+2−2
@@ -156,7 +156,7 @@ data StartContainerOpts = StartContainerOpts
156156 { _Binds :: [T.Text]
157157 , _Links :: [T.Text]
158158 , _LxcConf :: [(T.Text, T.Text)]
159− , _PortBindings :: [(T.Text, [(T.Text, T.Text)])]
159+ , _PortBindings :: [((Int,T.Text),Int)]
160160 , _PublishAllPorts :: Bool
161161 , _Privileged :: Bool
162162 , _Dns :: [T.Text]
@@ -179,7 +179,7 @@ instance ToJSON StartContainerOpts where
179179 [ "Binds" .= _Binds
180180 , "Links" .= _Links
181181 , "LxcConf" .= _LxcConf
182− , "PortBindings" .= _PortBindings
182+ , "PortBindings" .= object (map (\((h,p),c)->T.concat [T.pack (show h),"/",p] .= [object ["HostPort" .= show c]]) _PortBindings)
183183 , "PublishAllPorts" .= _PublishAllPorts
184184 , "Privileged" .= _Privileged
185185 , "Dns" .= _Dns