Move setting Spree.root_domain earlier in the chain#1
Conversation
|
I have read the CLA Document and I hereby sign the CLA You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot. |
WalkthroughThe Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
config/initializers/spree_multi_store.rb (1)
4-4: Consider handling blankSPREE_ROOT_DOMAINas fallback to default.If
SPREE_ROOT_DOMAINis present but empty,ENV.fetchreturns""instead of"localhost", which can silently disable auto URL generation.Suggested tweak
-Spree.root_domain = ENV.fetch('SPREE_ROOT_DOMAIN', 'localhost') +Spree.root_domain = ENV['SPREE_ROOT_DOMAIN'].presence || 'localhost'🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@config/initializers/spree_multi_store.rb` at line 4, The current assignment to Spree.root_domain uses ENV.fetch('SPREE_ROOT_DOMAIN', 'localhost') which treats an explicit empty string as a valid value; change it to treat blank/whitespace-only values as missing by reading ENV['SPREE_ROOT_DOMAIN'] (or ENV.fetch with empty default), trim it, and fall back to 'localhost' when the result is empty so Spree.root_domain is never set to an empty string; update the code around the Spree.root_domain assignment to implement this blank-aware fallback.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@config/initializers/spree_multi_store.rb`:
- Line 4: The current assignment to Spree.root_domain uses
ENV.fetch('SPREE_ROOT_DOMAIN', 'localhost') which treats an explicit empty
string as a valid value; change it to treat blank/whitespace-only values as
missing by reading ENV['SPREE_ROOT_DOMAIN'] (or ENV.fetch with empty default),
trim it, and fall back to 'localhost' when the result is empty so
Spree.root_domain is never set to an empty string; update the code around the
Spree.root_domain assignment to implement this blank-aware fallback.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5e03a13a-8e0a-4dab-b452-1412ab5a150f
📒 Files selected for processing (1)
config/initializers/spree_multi_store.rb
Summary by CodeRabbit