summaryrefslogtreecommitdiff
path: root/server/Server.hs
diff options
context:
space:
mode:
Diffstat (limited to 'server/Server.hs')
-rw-r--r--server/Server.hs16
1 files changed, 11 insertions, 5 deletions
diff --git a/server/Server.hs b/server/Server.hs
index 77eebbc..bcb96a0 100644
--- a/server/Server.hs
+++ b/server/Server.hs
@@ -37,8 +37,7 @@ import qualified Data.Aeson as A
import qualified Data.ByteString.Base64.URL as Base64
import Data.Functor.Contravariant (contramap)
import qualified Data.Map as M
-import Lens.Micro.Platform (at, ix, makeLenses, traverseOf,
- traversed)
+import Lens.Micro.Platform (at, ix, makeLenses, traverseOf)
import LintConfig (LintConfig')
import Servant (FromHttpApiData)
import Toml (TomlCodec, prettyTomlDecodeErrors,
@@ -47,8 +46,10 @@ import qualified Toml as T
-- | a reference in a remote git repository
data RemoteRef = RemoteRef
- { repourl :: Text
- , reporef :: Text
+ { repourl :: Text
+ , reporef :: Text
+ , reponame :: Text
+ -- ^ the "world name" for the hub / world:// links
} deriving (Generic, FromJSON, ToJSON, Eq, Ord, Show)
type family ConfigRes (b :: Bool) a where
@@ -78,6 +79,8 @@ data Org (loaded :: Bool) = Org
, orgLintconfig :: ConfigRes loaded LintConfig'
, orgEntrypoint :: FilePath
, orgRepos :: [RemoteRef]
+ , orgUrl :: Text
+ , orgWebdir :: Text
} deriving Generic
-- | Orgs are compared via their slugs only
@@ -116,6 +119,7 @@ remoteCodec :: TomlCodec RemoteRef
remoteCodec = RemoteRef
<$> T.text "url" .= repourl
<*> T.text "ref" .= reporef
+ <*> T.text "name" .= reponame
orgCodec :: TomlCodec (Org False)
orgCodec = Org
@@ -123,6 +127,8 @@ orgCodec = Org
<*> T.string "lintconfig" .= orgLintconfig
<*> T.string "entrypoint" .= orgEntrypoint
<*> T.list remoteCodec "repo" .= orgRepos
+ <*> T.text "url" .= orgUrl
+ <*> T.text "webdir" .= orgWebdir
configCodec :: TomlCodec (Config False)
@@ -135,7 +141,7 @@ configCodec = Config
-- | a job status (of a specific uuid)
data JobStatus =
- Pending | Linted DirResult | Failed Text
+ Pending | Linted DirResult Text | Failed Text
deriving (Generic, ToJSON)
-- | the server's global state; might eventually end up with more