mirror of
https://github.com/zoriya/Aeris.git
synced 2026-06-03 03:01:46 +00:00
Saving jwk keys to a cache.
This commit is contained in:
+4
-2
@@ -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
|
||||
|
||||
@@ -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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user