Skip to content

Commit c4a6a70

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 f98976d commit c4a6a70

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

lib/tiny_admin/basic_app.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def authentication_plugin
1616

1717
plugin :flash
1818
plugin :not_found
19-
plugin :render, engine: 'html'
20-
plugin :sessions, secret: SecureRandom.hex(64)
19+
plugin :render, engine: "html"
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)