Skip to content

Issue with applications using initializers that connect to a database #2

@laph

Description

@laph

I'd like to give you some feedback to your plugin. In general it works fine, however, there is a issue if a application has initializers in lib/initializers/ directory which try to establish a database connection. In such a case, the application won't start or be spawned by Passenger (in production env.).

I'm not absolutely sure why this happens. My guess is that these initializers attempt a db connection even before the prepend_before filter from the Application Controller is invoked and therefore use and search for the db connection details as usual in the config/database.yml's 'production' section.

Workaround:
By keeping a (valid) 'dummy' production section in the old database.yml file it's possible to still spawn the application in production. Of course this might have some impact on the application's behaviour depending on what the initializer is doing.

Any idea's on how to solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions