git.iko.soy/typeable/octopod
on master help sign in
change serialization format of environment variables in DB
commit0aa49d7206877a38cde5eb9c2c122e0e91046651 authorAndrei Orlov <aaorlov1@gmail.com> dateMon 10 Feb 2020, 13:29 (7 years ago) parenta41436e
2 files changed+5−6
src/DMC/Lib.hs−1 src/DMS/Lib.hs+5−5
src/DMC/Lib.hs−1
@@ -36,7 +36,6 @@ runDMC = do
3636 args <- getRecord "DMC"
3737 print (args :: Args)
3838
39− let port = 4000
4039 manager <- newManager defaultManagerSettings
4140 env <- getBaseUrl
4241 handleCommand (mkClientEnv manager env) args
src/DMS/Lib.hs+5−5
@@ -7,12 +7,12 @@ module DMS.Lib
77 ( runDMS
88 ) where
99
10−import Prelude hiding (unwords, words)
10+import Prelude hiding (unwords, lines, unlines)
1111
1212import Control.Monad.IO.Class
1313import Data.ByteString (ByteString)
1414import Data.Int (Int64)
15−import Data.Text (unpack, unwords, words)
15+import Data.Text (lines, unlines, unpack, unwords)
1616import Data.Pool
1717import Database.PostgreSQL.Simple
1818import Options.Generic
@@ -80,7 +80,7 @@ create p d = do
8080 createDeployment :: Deployment -> Handler Int64
8181 createDeployment (Deployment n t e) = liftIO $
8282 withResource p $ \conn ->
83− execute conn "INSERT INTO deployments (name, template, envs) VALUES (?, ?, ?)" (n, t, unwords e)
83+ execute conn "INSERT INTO deployments (name, template, envs) VALUES (?, ?, ?)" (n, t, unlines e)
8484
8585 executeHelmCommand :: String -> Handler ()
8686 executeHelmCommand helm = liftIO . withProcessWait_ (proc helm ["version"]) $ \pr -> do
@@ -95,7 +95,7 @@ get p n = do
9595
9696 where
9797 getDeployment :: Handler [Deployment]
98− getDeployment = fmap (fmap (\(n, t, e) -> Deployment n t $ words e)) . liftIO $
98+ getDeployment = fmap (fmap (\(n, t, e) -> Deployment n t $ lines e)) . liftIO $
9999 withResource p $ \conn -> query conn "SELECT name, template, envs FROM deployments WHERE name = ?" (Only n)
100100
101101edit :: PgPool -> Text -> Deployment -> Handler Text
@@ -108,7 +108,7 @@ edit p n (Deployment _ _ e) = do
108108 updateDeployment :: Handler Int64
109109 updateDeployment = liftIO $
110110 withResource p $ \conn ->
111− execute conn "UPDATE deployments SET envs = ?, updated_at = now() WHERE name = ?" (unwords e, n)
111+ execute conn "UPDATE deployments SET envs = ?, updated_at = now() WHERE name = ?" (unlines e, n)
112112
113113destroy :: PgPool -> Text -> Handler Text
114114destroy p n = do