Skip to content

web-console in initializer #339

@beniutek

Description

@beniutek

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions