summaryrefslogtreecommitdiff
path: root/Biz
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2025-11-20 17:58:45 -0500
committerBen Sima <ben@bsima.me>2025-11-20 17:58:45 -0500
commit2c4f916861d35038c0b7e1142aab10f149637bf3 (patch)
treeeebc184d07adf4efe90360226371c71f65dee86a /Biz
parent93e49d92fd0c3ad07376c8aad091374dcfe484cf (diff)
parent2659f0ffeac500b615813c7a806ab20de7d51ba2 (diff)
Merge branch 'live' into omni-worker-1
Diffstat (limited to 'Biz')
-rwxr-xr-xBiz/Dragons.hs14
1 files changed, 13 insertions, 1 deletions
diff --git a/Biz/Dragons.hs b/Biz/Dragons.hs
index 7ba7fa0..cfe211e 100755
--- a/Biz/Dragons.hs
+++ b/Biz/Dragons.hs
@@ -742,7 +742,19 @@ startup quiet = do
cfg <- Envy.decodeWithDefaults Envy.defConfig
oAuthArgs <- Envy.decodeWithDefaults Envy.defConfig
kp <- Acid.openLocalStateFrom (keep cfg) init :: IO (Acid.AcidState Keep)
- jwk <- Auth.generateKey -- TODO: store this in a file somewhere
+ let jwkPath = keep cfg </> "jwk.json"
+ jwkExists <- Directory.doesFileExist jwkPath
+ jwk <-
+ if jwkExists
+ then do
+ maybeKey <- Aeson.decodeFileStrict jwkPath
+ case maybeKey of
+ Nothing -> panic <| "Could not decode JWK from " <> str jwkPath
+ Just k -> pure k
+ else do
+ k <- Auth.generateKey
+ Aeson.encodeFile jwkPath k
+ pure k
let url = case homeExample cfg of
ForgeURL u -> u
CLISubmission -> "<CLISubmission>"