Sha256: 841bc4b98024192ad5c16ca7b490b3c8f3e50ae77e0bf63ae835e83fb8d4227c

Contents?: true

Size: 653 Bytes

Versions: 1

Compression:

Stored size: 653 Bytes

Contents

module EnvJson
  # Rails hook to autoload ENV from JSON file before configuration
  class Railtie < Rails::Railtie
    config.before_configuration { load_env }

    # railtie hook to load env with Rails.env as environment name and config/env.json files as source
    def load_env()
      env_json_file = Rails.root.join('config/env.json')
      environment_name = Rails.env
      puts "EnvJson: file #{env_json_file} does not exists" && return unless File.exist? env_json_file
      EnvJson.load_env_from_source_with_overrides(env_json_file, environment_name)
    end

    rake_tasks do
      load File.join(__dir__, 'rails_tasks.rb')
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
env_json-0.3.2 lib/env_json/railtie.rb