Sha256: 1acc66b88204801d87a39a2839f0c27a1061979aa66cad966ea3d044d75f9004
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true module Orchestration class Environment def initialize(options = {}) @environment = options.fetch(:environment, nil) end def environment return @environment unless @environment.nil? ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development' end def database_url ENV['DATABASE_URL'] end def mongoid_configuration_path root.join('config', 'mongoid.yml') end def database_configuration_path root.join('config', 'database.yml') end def rabbitmq_configuration_path root.join('config', 'rabbitmq.yml') end def orchestration_configuration_path root.join('.orchestration.yml') end def docker_compose_configuration_path root.join('docker-compose.yml') end def docker_compose_config YAML.safe_load(File.read(docker_compose_configuration_path)) end def docker_compose_config? docker_compose_configuration_path.file? end def application_name Rails.application.class.parent.name.underscore end def settings Settings.new(orchestration_configuration_path) end def root return Rails.root if defined?(Rails) && Rails.root Pathname.new(Dir.pwd) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
orchestration-0.2.8 | lib/orchestration/environment.rb |