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

web-console in initializer #339

Open
beniutek opened this issue Jul 22, 2024 · 0 comments
Open

web-console in initializer #339

beniutek opened this issue Jul 22, 2024 · 0 comments

Comments

@beniutek
Copy link

beniutek commented Jul 22, 2024

Hello,

I have a problem setting up the gem if I want to configure it from the initializers folder.

So, when I configure the gem inside the development.rb file everything is alright

example working config:

Rails.application.configure do
  config.web_console.permissions = ENV.fetch('ALLOWED_IP', nil)
end

but when I do a similar thing in my config/initializers/web_console.rb like so:

# frozen_string_literal: true

if Rails.env.development?
  Rails.application.configure do
    config.web_console.permissions = ENV.fetch('ALLOWED_IP', nil)
  end
end

the console command is not working and the console is not appearing when an error is raised or when I manually add the console command e.g. in my controller actions.

Have you seen a problem like this before? Or do you already know that configuring the gem from config/initializers is not possible maybe?

EDIT:

After doing some console outputs it seems to me that it's just an ordering of things.

  • First, it's the config/environments/development.rb that runs
  • Second it's whatever is inside the web-console gem lib/web_console/railtie.rb that runs
  • Third it's what's in the config/initializers/web_console.rb (This is the file where I'm trying to configure web-console in my project) that is running

However, the configuration I'm setting in the config/initializers/web_console.rb is not picked up by the gem.

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

No branches or pull requests

1 participant