diff options
author | stuebinm | 2022-02-16 20:28:46 +0100 |
---|---|---|
committer | stuebinm | 2022-02-16 20:28:46 +0100 |
commit | 7c73bf1d94b8a972ba64fb8210290de7e6ab2839 (patch) | |
tree | 92f4ab4fa83fa6e82241a3cc181e9dcf27dd0907 /server/Server.hs | |
parent | b3c3b5d727f2c8548ab72ff07a0f8c6b9844bfac (diff) |
server: exneuland wants a token, apparently
Diffstat (limited to '')
-rw-r--r-- | server/Server.hs | 15 |
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) |