Skip to content
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

Deprecate RACK_ENV in favour of APP_ENV #2031

Merged
merged 1 commit into from
Apr 16, 2024
Merged

Conversation

svoop
Copy link
Contributor

@svoop svoop commented Feb 19, 2024

Say goodbye for the often misused RACK_ENV in favour of APP_ENV (like Sinatra does). A deprecation warning is printed if only RACK_ENV is set and Golllum has not yet reached version 6.

Related issue: #2029

Copy link
Member

@benjaminwil benjaminwil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this contribution.

I will defer to @dometto to approve and merge, as he has a clearer picture of what the 6.0.0 release looks like.

bin/gollum Outdated
Comment on lines 286 to 288
if Gollum::VERSION < "6.0.0" && ENV['RACK_ENV'] && !ENV['APP_ENV']
warn "[DEPRECATION] RACK_ENV will be ignored as of gollum-6.0.0, please use APP_ENV instead."
ENV['APP_ENV'] = ENV['RACK_ENV']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was surprised to learn that this string comparison works.

If Gollum was a project that had more pre-releases (i.e. 6.0.0.alpha) I would reach for a more-expressive Gem::Version comparison:

Gem::Version.new(Gollum::VERSION) < Gem::Version.new("6.0.0")

But I manually tested that this does the right thing, and it does. So looks good to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I'm not really sure whether checking for the version there is a good idea at all. Might just as well without, provided someone keeps track of such post-release TODOs.

Copy link
Member

@dometto dometto Feb 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it could be alright to leave out the version check, if we open an issue to remove the deprecation notice. Even with the check present, we'll have to remember to remove the code at some point, so it doesn't make that much of a difference I think.

So I propose that we keep the deprecation notice (without the version check) until 7.0 (because 6.0 will happen very soon when I'm back from leave) and open an issue to remind ourselves to remove the relevant code in that release.

I also learned something new about string comparisons today! 😀

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dometto Sorry for the delay, this slipped off my desk somehow. I've removed the version check and just kept the # TODO which mentions the lines to be removed once gollum-7 is released.

@dometto dometto merged commit 1714de6 into gollum:master Apr 16, 2024
6 checks passed
@dometto
Copy link
Member

dometto commented Apr 16, 2024

Thank you @svoop and sorry for the delay!

@svoop
Copy link
Contributor Author

svoop commented Apr 16, 2024

Easy, thanks for the merge!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants