Skip to content

Commit 3fc0e2e

Browse files
ihabadhamclaude
andcommitted
Align renderer_password initializer with Pro docs + source
Previous commit added Rails.env-branching + explicit raise in non-local envs. That duplicates what Pro's configuration.rb already does at boot (validate_renderer_password_for_production) and diverges from the documented pattern in pro/node-renderer.md and pro/installation.md. Revert to the simple ENV.fetch with a dev default. Pro handles the prod-enforcement itself — if RENDERER_PASSWORD is unset in a production-like env, Pro raises at boot with a helpful error message pointing at exactly this fix. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a3b9535 commit 3fc0e2e

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

config/initializers/react_on_rails_pro.rb

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,8 @@
1717
config.renderer_url = ENV.fetch("REACT_RENDERER_URL", "http://localhost:3800")
1818

1919
# Shared secret for renderer authentication. Must match renderer/node-renderer.js.
20-
# In dev and test, both sides default to the same value so `bin/dev` works
21-
# without setup. In production, RENDERER_PASSWORD must be set explicitly —
22-
# falling back to a known-public dev string in prod would auth-bypass the
23-
# renderer.
24-
config.renderer_password = if Rails.env.local?
25-
ENV.fetch("RENDERER_PASSWORD", "local-dev-renderer-password")
26-
else
27-
ENV.fetch("RENDERER_PASSWORD")
28-
end
20+
# In production-like envs, Pro's configuration.rb raises at boot if this is
21+
# blank and RENDERER_PASSWORD isn't in the environment — so the dev fallback
22+
# below never reaches prod as long as RENDERER_PASSWORD is set there.
23+
config.renderer_password = ENV.fetch("RENDERER_PASSWORD", "local-dev-renderer-password")
2924
end

0 commit comments

Comments
 (0)