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

config.enabled config not working #26

Open
MichalRemis opened this issue Jun 21, 2023 · 5 comments
Open

config.enabled config not working #26

MichalRemis opened this issue Jun 21, 2023 · 5 comments
Labels
help wanted Extra attention is needed

Comments

@MichalRemis
Copy link

MichalRemis commented Jun 21, 2023

I am using multiple development environments, but I found that rails_live_reload doesn't work in environments named other than "development". I have set the config in initializer:

config.enabled = Rails.env.development? || Rails.env.development_pl? || Rails.env.development_cz?

But it doesn't work. It's probably because initializers/rails_live_reload.rb is evaluated after rails_live_reload/engine.rb is loaded, where there is condition checking this (if RailsLiveReload.enabled? && defined?(::Rails::Server)...), which therefore doesn't use the config from intializer.

Is there please a way to make live reload work in environments other than 'development'?

I am using rails (6.1.4.1) and rails_live_reload (0.3.4)

@igorkasyanchuk
Copy link
Contributor

hmm, interesting case
@MichalRemis can you try to contribute to the gem?

@MichalRemis
Copy link
Author

@igorkasyanchuk sorry I am too busy atm.. Maybe I would just remove config.enabled option from docs, since it doesn't work

@igorkasyanchuk
Copy link
Contributor

no, removing it from doc has no value

I would just suggest to wait when you will have time, us or someone else

this setting should be modified

@enabled = ::Rails.env.development?

for now you can just fork and edit it by yousefl

@igorkasyanchuk igorkasyanchuk added the help wanted Extra attention is needed label Jun 23, 2023
@igorkasyanchuk
Copy link
Contributor

and if someone want's to fix, a possible approach can be like this https://github.com/igorkasyanchuk/rails_performance/blob/master/lib/rails_performance.rb#L55-L56

@MGPalmer
Copy link

MGPalmer commented Feb 7, 2024

I suppose noone had time yet? I just stumbled over the config option not working, I tried to make it configurable in our project like this:

config.enabled = (Rails.env.development? and (ENV.fetch("DISABLE_LIVE_RELOAD", nil) != "true"))

and also found that the setting seems to have no effect..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants