summaryrefslogtreecommitdiff
path: root/server/Server.hs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--server/Server.hs15
1 files changed, 9 insertions, 6 deletions
diff --git a/server/Server.hs b/server/Server.hs
index ef01b88..8f09ac7 100644
--- a/server/Server.hs
+++ b/server/Server.hs
@@ -19,7 +19,7 @@
module Server ( loadConfig
, Org(..)
, Sha1
- , Config, tmpdir, port, verbose, orgs, interval, exneuland
+ , Config, tmpdir, port, verbose, orgs, interval, exneuland, token
, RemoteRef(..)
, ServerState, emptyState, unState
, JobStatus(..)
@@ -36,19 +36,19 @@ import Data.Aeson (FromJSON, ToJSON, ToJSONKey (..),
eitherDecodeFileStrict')
import qualified Data.Aeson as A
import qualified Data.ByteString.Base64.URL as Base64
+import Data.Coerce (coerce)
+import Data.Either.Extra (mapLeft)
import Data.Functor.Contravariant (contramap)
import qualified Data.Map as M
import Lens.Micro.Platform (at, ix, makeLenses, traverseOf)
import LintConfig (LintConfig')
import Servant (FromHttpApiData)
-import Servant.Client (BaseUrl,
- parseBaseUrl)
+import Servant.Client (BaseUrl, parseBaseUrl)
import Toml (BiMap (BiMap), TomlBiMap,
TomlBiMapError (ArbitraryError),
- TomlCodec,
- prettyTomlDecodeErrors, (.=))
+ TomlCodec, prettyTomlDecodeErrors,
+ (.=))
import qualified Toml as T
-import Data.Either.Extra (mapLeft)
-- | a reference in a remote git repository
data RemoteRef = RemoteRef
@@ -116,6 +116,7 @@ data Config (loaded :: Bool) = Config
, _interval :: Int
-- ^ port to bind to
, _exneuland :: BaseUrl
+ , _token :: Maybe Text
, _orgs :: [Org loaded]
} deriving Generic
@@ -150,6 +151,8 @@ configCodec = Config
<*> T.bool "verbose" .= _verbose
<*> T.int "interval" .= _interval
<*> T.match (urlBimap >>> T._String) "exneuland" .= _exneuland
+ -- First is just Maybe but with different semantics
+ <*> coerce (T.first T.text "token") .= _token
<*> T.list orgCodec "org" .= _orgs
-- | a job status (of a specific uuid)