Compare commits

...

7 commits
jswt ... master

Author SHA1 Message Date
4c2692fb31 more touching 2024-09-06 02:18:35 +02:00
028d8794b3 touch 2024-08-31 02:07:57 +02:00
f0a888decf some cleaning 2024-02-28 13:11:41 +01:00
96409f3118 flake update 2024-02-28 11:58:09 +01:00
f2b7b60231 clarify package 2024-02-28 11:36:46 +01:00
0d8649407f reintroduce version bound and propagate it 2024-02-28 11:36:46 +01:00
c688bc1b86 remove version bound 2024-02-28 11:36:46 +01:00
7 changed files with 54 additions and 29 deletions

2
.gitignore vendored
View file

@ -12,3 +12,5 @@ report.html
*.save* *.save*
.envrc .envrc
.direnv/ .direnv/
.hie/
stan.html

View file

@ -11,27 +11,37 @@ module Main where
import Prelude as P import Prelude as P
import Crypto.JWT hiding (Context, header) import Crypto.JWT hiding (Context, header)
import Crypto.JOSE.JWK hiding (Context)
import Control.Concurrent.STM.TVar
import Control.Concurrent.STM (newTQueueIO) import Control.Concurrent.STM (newTQueueIO)
import Control.Concurrent (forkIO) import Control.Concurrent (forkIO)
import Control.Lens hiding (Context)
import Control.Monad (void, unless)
import Control.Monad.Reader
import Servant import Servant
import Servant.Server.Experimental.Auth import Servant.Server.Experimental.Auth
import qualified Servant.OpenApi as OA import qualified Servant.OpenApi as OA
import Servant.Swagger.UI import Servant.Swagger.UI
import Servant.RawM import Servant.RawM.Server
import qualified Data.Aeson as A
import Data.Set as S (empty) import Data.Set as S (empty)
import qualified Data.ByteString.Lazy as B import qualified Data.ByteString.Lazy as B
import Data.ByteString.Char8 as B8 hiding (putStrLn) import Data.ByteString.Char8 as B8 hiding (putStrLn)
import qualified Data.Text as T import qualified Data.Text as T
import qualified Data.Text.Encoding as TE import qualified Data.Text.Encoding as TE
import Data.String import Data.String
import Data.Yaml import Data.Yaml
import Data.Version (showVersion) import Data.Version (showVersion)
import qualified Data.OpenApi as OA hiding (Server) import qualified Data.OpenApi as OA hiding (Server)
import Database.PostgreSQL.Simple import Database.PostgreSQL.Simple
@ -42,12 +52,6 @@ import Network.Wai
import Network.Wai.Logger import Network.Wai.Logger
import Network.Wai.Handler.Warp import Network.Wai.Handler.Warp
import Control.Monad.Reader
import Control.Concurrent.STM.TVar
import Control.Lens hiding (Context)
import Options.Applicative import Options.Applicative
import System.Clock (TimeSpec(..)) import System.Clock (TimeSpec(..))
@ -149,7 +153,6 @@ main = do
, rsJWTSecret = , rsJWTSecret =
fromOctets . B.fromStrict $ TE.encodeUtf8 jwt_secret fromOctets . B.fromStrict $ TE.encodeUtf8 jwt_secret
} }
expirationSpec = TimeSpec 5 0 -- five seconds
runSettings settings (app initState) runSettings settings (app initState)
where where
opts = info (options <**> helper) opts = info (options <**> helper)

View file

@ -5,11 +5,11 @@
"systems": "systems" "systems": "systems"
}, },
"locked": { "locked": {
"lastModified": 1705309234, "lastModified": 1710146030,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -20,11 +20,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1709116111, "lastModified": 1725059563,
"narHash": "sha256-V7BbC39cGDOzJsCsmg+hCdBu1Tuhqs7kLcPxw86STh4=", "narHash": "sha256-laJvLHrSU5M9zWlejH7H67HdpLhcUI6uPDa4rX7eUuE=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "b84d9f029fa675d5ef312f032f322889149daa82", "rev": "0abfc619bcb605299a0f3f01c1887bb65db61a6b",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -72,10 +72,22 @@ library
-- Modules included in this library but not exported. -- Modules included in this library but not exported.
-- other-modules: -- other-modules:
default-extensions:
StrictData
other-extensions: other-extensions:
DataKinds TypeOperators FlexibleInstances MultiParamTypeClasses DataKinds
RankNTypes ScopedTypeVariables FlexibleContexts OverloadedStrings TypeOperators
Arrows CPP LambdaCase DeriveGeneric TypeFamilies FlexibleInstances
MultiParamTypeClasses
RankNTypes
ScopedTypeVariables
FlexibleContexts
OverloadedStrings
Arrows
CPP
LambdaCase
DeriveGeneric
TypeFamilies
TypeSynonymInstances TypeSynonymInstances
build-depends: build-depends:
@ -93,7 +105,6 @@ library
, servant , servant
, servant-server , servant-server
, servant-openapi3 , servant-openapi3
, servant-rawm >= 0.3.0.0
, servant-rawm-server , servant-rawm-server
, opaleye , opaleye
, aeson , aeson
@ -111,12 +122,14 @@ library
, haskell-gettext , haskell-gettext
, mime-mail , mime-mail
, directory , directory
, jose , jose >= 0.10
, monad-time , monad-time
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall ghc-options: -Wall
-fwrite-ide-info
-hiedir=.hie
executable mateamt executable mateamt
main-is: Main.hs main-is: Main.hs
@ -127,6 +140,8 @@ executable mateamt
AppTypes.Configuration AppTypes.Configuration
Janitor Janitor
Paths_mateamt Paths_mateamt
default-extensions:
StrictData
other-extensions: other-extensions:
DataKinds TypeOperators FlexibleInstances MultiParamTypeClasses DataKinds TypeOperators FlexibleInstances MultiParamTypeClasses
RankNTypes ScopedTypeVariables FlexibleContexts OverloadedStrings RankNTypes ScopedTypeVariables FlexibleContexts OverloadedStrings
@ -151,7 +166,7 @@ executable mateamt
, network , network
, servant , servant
, servant-server , servant-server
, servant-rawm , servant-rawm-server
, servant-openapi3 , servant-openapi3
, servant-swagger-ui , servant-swagger-ui
, servant-swagger-ui-core , servant-swagger-ui-core
@ -170,6 +185,8 @@ executable mateamt
hs-source-dirs: app hs-source-dirs: app
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall ghc-options: -Wall
-fwrite-ide-info
-hiedir=.hie
-- test-suite mateamt-test -- test-suite mateamt-test
-- default-language: Haskell2010 -- default-language: Haskell2010

View file

@ -13,8 +13,7 @@ import Servant.Server
import Data.Proxy import Data.Proxy
import Servant.RawM import Servant.RawM.Server
import Servant.RawM.Server ()
-- internal imports -- internal imports
@ -124,7 +123,7 @@ journalShowLink :: Maybe Int -> Maybe Int -> Link
journalPostCheck :: Link journalPostCheck :: Link
avatarGetLink :: Int -> Link avatarGetLink :: Int -> Link
avaterInsertLink :: Link avatarInsertLink :: Link
avatarUpdateLink :: Int -> Link avatarUpdateLink :: Int -> Link
avatarListLink :: Link avatarListLink :: Link
@ -137,7 +136,7 @@ roleAssociationSubmitLink :: Link
roleAssociationDeleteLink :: Link roleAssociationDeleteLink :: Link
settingsGetLink :: Link settingsGetLink :: Link
settingsUpdateLnk :: Link settingsUpdateLink :: Link
metaGetLink :: Link metaGetLink :: Link
@ -168,7 +167,7 @@ metaGetLink :: Link
journalPostCheck :<|> journalPostCheck :<|>
avatarGetLink :<|> avatarGetLink :<|>
avaterInsertLink :<|> avatarInsertLink :<|>
avatarUpdateLink :<|> avatarUpdateLink :<|>
avatarListLink :<|> avatarListLink :<|>
@ -181,7 +180,7 @@ metaGetLink :: Link
roleAssociationDeleteLink :<|> roleAssociationDeleteLink :<|>
settingsGetLink :<|> settingsGetLink :<|>
settingsUpdateLnk :<|> settingsUpdateLink :<|>
metaGetLink metaGetLink
) = allLinks (Proxy :: Proxy MateAPI) ) = allLinks (Proxy :: Proxy MateAPI)

View file

@ -11,8 +11,10 @@ metaGet :: MateHandler MetaInformation
metaGet = do metaGet = do
symbol <- asks rsCurrencySymbol symbol <- asks rsCurrencySymbol
version <- asks rsSoftwareVersion version <- asks rsSoftwareVersion
decimals <- asks rsCurrencyFraction
return (MetaInformation return (MetaInformation
{ metaInfoVersion = version { metaInfoVersion = version
, metaInfoCurrency = symbol , metaInfoCurrency = symbol
, metaInfoDecimals = fromIntegral decimals
} }
) )

View file

@ -1,6 +1,8 @@
{-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE OverloadedStrings #-}
module Control.Settings where module Control.Settings where
import Control.Monad (void, unless)
import Control.Monad.Reader import Control.Monad.Reader
import Servant import Servant