Skip to content

Smarter initialization of default configuration #528

@tjohnell-handy

Description

@tjohnell-handy

Hello,

I ran into an interesting situation where I planned to use the default ENV var REDIS_URL to configure Redis and therefore did not explicitly set Split.redis on initialization of my Rails app. We use Figaro (https://github.com/laserlemon/figaro) to manage ENV variables, and I believe what's happening is Split is being loaded prior to any configuration/initialization of the Rails app (https://github.com/splitrb/split/blob/master/lib/split.rb#L69).

Split configuration, however, could be a little smarter. For instance, if it were to check for the existence of Railtie and conclude it's present, it could hook the initial configuration into the before_initialize callback. That would allow for gems like Figaro and dotenv to properly load relevant ENV variables allowing this gem to be more plug-and-play.

Just a recommendation. I wouldn't mind helping in my free time to submit a PR if you're interested.

Best,
Tom Johnell

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions