Skip to content

Commit b85ada9

Browse files
committed
feat(auth): accept session secret from TINY_ADMIN_SECRET env var
The session secret was regenerated with SecureRandom.hex(64) on every boot, which invalidates all existing sessions on restart. Now reads from ENV["TINY_ADMIN_SECRET"] with fallback to the random value, so production deployments can maintain stable sessions across restarts.
1 parent 303d906 commit b85ada9

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

lib/tiny_admin/basic_app.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ def authentication_plugin
1717
plugin :flash
1818
plugin :not_found
1919
plugin :render, engine: "html"
20-
plugin :sessions, secret: SecureRandom.hex(64)
20+
plugin :sessions, secret: ENV.fetch("TINY_ADMIN_SECRET") { SecureRandom.hex(64) }
2121

2222
plugin authentication_plugin, TinyAdmin.settings.authentication
2323

0 commit comments

Comments
 (0)