lib/anyway_config.rb in anyway_config-2.0.0.pre vs lib/anyway_config.rb in anyway_config-2.0.0.pre2
- old
+ new
@@ -1,3 +1,32 @@
# frozen_string_literal: true
-require "anyway"
+module Anyway # :nodoc:
+ require "anyway/version"
+
+ require "anyway/config"
+ require "anyway/rails/config" if defined?(::Rails::VERSION)
+ require "anyway/env"
+
+ # Use Settings name to not confuse with Config.
+ #
+ # Settings contain the library-wide configuration.
+ class Settings
+ class << self
+ # Define whether to load data from
+ # *.yml.local (or credentials/local.yml.enc)
+ attr_accessor :use_local_files
+ end
+
+ # By default, use local files only in development (that's the purpose if the local files)
+ self.use_local_files = (ENV["RACK_ENV"] == "development" || ENV["RAILS_ENV"] == "development")
+ end
+
+ class << self
+ def env
+ @env ||= ::Anyway::Env.new
+ end
+ end
+
+ require "anyway/railtie" if defined?(::Rails::VERSION)
+ require "anyway/testing" if ENV["RACK_ENV"] == "test" || ENV["RAILS_ENV"] == "test"
+end