fix undefined references to JWT_SECRET

This commit is contained in:
Ryan Cavicchioni 2025-05-09 10:47:10 -05:00
parent b92f6688c7
commit 66c2c3b6a2
Signed by: ryanc
SSH Key Fingerprint: SHA256:KbXiwUnZnHFwFtt3Bytd+F3FN9pPHn1Z1cxMIE1TPbg

4
app.rb
View File

@ -384,7 +384,7 @@ get "/token" do
exp = Time.now.to_i + SECONDS_PER_MINUTE * 2
payload = {name: "anonymous", exp: exp, jti: Random.uuid}
expires_at = Time.at(exp).to_datetime
token = JWT.encode payload, JWT_SECRET, "HS256"
token = JWT.encode payload, config.jwt_secret.unwrap, "HS256"
x = {token: token, expires_at: expires_at}
jsonify x
@ -392,7 +392,7 @@ end
get "/token/validate" do
token = req_headers["authorization"].split[1]
payload = JWT.decode token, JWT_SECRET, true, algorithm: "HS256"
payload = JWT.decode token, config.jwt_secret.unwrap, true, algorithm: "HS256"
jsonify payload
end