-
-
Notifications
You must be signed in to change notification settings - Fork 95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shakapacker.yml as the secondary source for asset_host and relative_url_root #376
Changes from all commits
30f70c9
5f45082
f4329de
7b83800
7e00d32
4a363ef
4b32eaa
3dcebb0
7374cb5
dd6484e
663f294
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -117,11 +117,19 @@ def fetch(key) | |
end | ||
|
||
def asset_host | ||
ENV.fetch("SHAKAPACKER_ASSET_HOST", ActionController::Base.helpers.compute_asset_host) | ||
ENV.fetch( | ||
"SHAKAPACKER_ASSET_HOST", | ||
fetch(:asset_host) || ActionController::Base.helpers.compute_asset_host | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. how about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 but no change? why? |
||
) | ||
end | ||
|
||
def relative_url_root | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this a public API? Do we need docs explaining this change? What is the migration if somebody used this ENV: Is this OK as a feature level bump? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry for not making it enough clear. I added more explanation in the commit message but it is not enough visible. So let's quote it here:
and from my private discussion with Judah, he phrased it this way:
So, we just inherited this extra unused configuration from Webpacker. I am not sure if we should keep carrying this code by deprecating it till the next major release. Mentioning this removal in the changelog wouldn't be bad (if needed). There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm I'm not quite following, but I think if We'll want to do a v8 for switching to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is also fine to me. @justin808 I reverted the last commit (of removing If agreed, and there is no other required changes, we are good to go with merge and 7.2 release. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, I agree with you. I don't see any good reason for introducing a new public interface to So I will narrow down this PR to only cover There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, the actual moving of the logic into the configuration was done in #374. This PR was to add some fixes and improve tests. The PR title is misleading. So I think now that all usages of |
||
ENV.fetch("SHAKAPACKER_RELATIVE_URL_ROOT", ActionController::Base.relative_url_root) | ||
Shakapacker.puts_deprecation_message "The usage of relative_url_root is deprecated in Shakapacker and will be removed in v8." | ||
|
||
ENV.fetch( | ||
"SHAKAPACKER_RELATIVE_URL_ROOT", | ||
fetch(:relative_url_root) || ActionController::Base.relative_url_root | ||
) | ||
end | ||
|
||
private | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ca fetch return a ""?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It can. Internally, it runs
fetch
on a hash. So it can potentially return""
or" "
. Though it is very unlikely someone deliberately passkey: ""
in the config file.Should we consider this in fetch as kind of normalization to ensure we either get a meaningful value or nil? I cannot think of any scenario where in the config we want to pass
""
and notnil
.