Saving jwk keys to a cache.

This commit is contained in:
Zoe Roux
2022-03-03 18:05:19 +01:00
parent cd20bffc66
commit 84b1b752c4
2 changed files with 7 additions and 2 deletions
+4 -2
View File
@@ -9,7 +9,7 @@ import Hasql.Pool (acquire)
import Hasql.Transaction (Transaction, condemn, sql, statement)
import Rel8 (each, insert, select)
import Servant
import Servant.Auth.Server (CookieSettings, JWTSettings, defaultCookieSettings, defaultJWTSettings, generateKey)
import Servant.Auth.Server (CookieSettings, JWTSettings, defaultCookieSettings, defaultJWTSettings, generateKey, readKey, writeKey)
import Network.Wai.Middleware.Servant.Errors
import App
import Config (dbConfigToConnSettings, getPostgresConfig)
@@ -19,10 +19,12 @@ import Lib
import Network.Wai
import Network.Wai.Handler.Warp
import System.Environment.MrEnv (envAsBool, envAsInt, envAsInteger, envAsString)
import Control.Applicative ((<|>))
main :: IO ()
main = do
key <- generateKey
let path = "/cache/key.jwk"
key <- readKey path <|> (writeKey path >> readKey path)
dbConf <- getPostgresConfig
appPort <- envAsInt "AERIS_BACK_PORT" 8080
let jwtCfg = defaultJWTSettings key
+3
View File
@@ -32,6 +32,8 @@ services:
- "8080:8080"
depends_on:
- "db"
volumes:
- cache:/cache
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
@@ -76,4 +78,5 @@ services:
volumes:
apk:
cache: