1{-# LANGUAGE OverloadedStrings #-}
2module Obelisk.ExecutableConfig.Inject where
4import Control.Monad (mapM_)
5import Control.Monad.IO.Class (MonadIO)
6import Data.ByteString (ByteString)
7import qualified Data.ByteString.Base64 as B64
9import qualified Data.Map as Map
10import Data.Semigroup ((<>))
11import Data.Text (Text)
12import qualified Data.Text.Encoding as T
13import Reflex.Dom.Core hiding (value)
15-- | Produces a @<script>@ tag with an @id@ attribute containing the key and
16-- whose value is the provided configuration, encoded in base64.
17injectPure :: DomBuilder t m => Text -> ByteString -> m ()
19 let attrs = ("type" =: "text/plain" <> "data-obelisk-executable-config-inject-key" =: key <> "data-hydration-skip" =: "")
20 in elAttr "script" attrs $ text (T.decodeUtf8 (B64.encode value))
22-- | Produces injectable @<script>@ tags containing the configuration keys
23-- (filepaths) and values.
24injectExecutableConfigs :: (MonadIO m, DomBuilder t m) => Map Text ByteString -> m ()
25injectExecutableConfigs = mapM_ (uncurry injectPure) . Map.toList
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list