king: In http-server/set-config effect, key+cert is Wain, not Cord.

This commit is contained in:
Benjamin Summers 2020-04-30 11:18:16 -07:00
parent e7d05988d3
commit 75f60504ee
3 changed files with 20 additions and 3 deletions

View File

@ -78,7 +78,7 @@ instance FromNoun H.StdMethod where
-- Http Server Configuration ---------------------------------------------------
newtype PEM = PEM { unPEM :: Cord }
newtype PEM = PEM { unPEM :: Wain }
deriving newtype (Eq, Ord, Show, ToNoun, FromNoun)
type Key = PEM

View File

@ -8,7 +8,7 @@ module Urbit.Noun.Conversions
, Bytes(..), Octs(..), File(..)
, Cord(..), Knot(..), Term(..), Tape(..), Tour(..)
, BigTape(..), BigCord(..)
, Wall, Each(..)
, Wain(..), Wall, Each(..)
, UD(..), UV(..), UW(..), cordToUW
, Mug(..), Path(..), EvilPath(..), Ship(..)
, Lenient(..), pathToFilePath, filePathToPath
@ -442,6 +442,20 @@ instance FromNoun Tape where
Right tx -> pure (Tape tx)
-- Wain -- List of Lines -------------------------------------------------------
newtype Wain = Wain { unWain :: Text }
deriving newtype (Eq, Ord, Show, IsString, NFData)
instance ToNoun Wain where
toNoun (Wain t) = toNoun (Cord <$> lines t)
instance FromNoun Wain where
parseNoun n = named "Wain" $ do
tx :: [Cord] <- parseNoun n
pure $ Wain $ unlines (unCord <$> tx)
-- Wall -- Text Lines ----------------------------------------------------------
type Wall = [Tape]

View File

@ -216,6 +216,9 @@ writePortsFile f = writeFile f . encodeUtf8 . portsFileText
cordBytes :: Cord -> ByteString
cordBytes = encodeUtf8 . unCord
wainBytes :: Wain -> ByteString
wainBytes = encodeUtf8 . unWain
pass :: Monad m => m ()
pass = pure ()
@ -506,7 +509,7 @@ startServ isFake conf plan = do
logDebug "startServ"
let tls = hscSecure conf <&> \(PEM key, PEM cert) ->
(W.tlsSettingsMemory (cordBytes cert) (cordBytes key))
(W.tlsSettingsMemory (wainBytes cert) (wainBytes key))
sId <- io $ ServId . UV . fromIntegral <$> (randomIO :: IO Word32)
liv <- newTVarIO emptyLiveReqs