diff options
| author | Ben Sima <ben@bsima.me> | 2025-11-20 17:54:08 -0500 |
|---|---|---|
| committer | Ben Sima <ben@bsima.me> | 2025-11-20 17:54:08 -0500 |
| commit | 2dc1dc7f433d49b94cbff4a6ec03a7ba318599f1 (patch) | |
| tree | 73a4fb81b1f9b49f21db68251c404804889f6c2f | |
| parent | d2c6915f9715d079f021660c22cc1fd39ed16bcd (diff) | |
| parent | cd83a32052f9579ca0763ed6f1db9b02e0a27ab9 (diff) | |
Merge branch 'task/t-1ne80pJ' into live
| -rwxr-xr-x | Biz/Dragons.hs | 14 |
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>" |
