diff --git a/Gemfile b/Gemfile index 5853db9d49..cb1d51c631 100644 --- a/Gemfile +++ b/Gemfile @@ -151,10 +151,7 @@ gem 'awesome_print' gem 'whenever', require: false # Admin toggles -# gem 'rails-settings-ui', '1.3.4' - -# gem 'rails-settings-cached', '0.7.2' -# gem 'dry-validation' +gem 'rails-settings-cached' # Respond to ELB healthchecks in /ping and /ping/ gem 'openstax_healthcheck' diff --git a/Gemfile.lock b/Gemfile.lock index e6ae66cc45..ff198f626c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -585,6 +585,9 @@ GEM rails-i18n (7.0.9) i18n (>= 0.7, < 2) railties (>= 6.0.0, < 8) + rails-settings-cached (2.9.4) + activerecord (>= 5.0.0) + railties (>= 5.0.0) railties (6.0.6.1) actionpack (= 6.0.6.1) activesupport (= 6.0.6.1) @@ -867,6 +870,7 @@ DEPENDENCIES rails-controller-testing rails-erd rails-i18n + rails-settings-cached redis-rails render_anywhere representable (~> 3.0.0) diff --git a/config/initializers/3-settings.rb b/config/initializers/3-settings.rb index e30602473c..33d14ec097 100644 --- a/config/initializers/3-settings.rb +++ b/config/initializers/3-settings.rb @@ -1,4 +1,4 @@ # We need to require settings here so we guarantee they are available # before other initialization code. -#require 'settings' +require 'settings' diff --git a/config/initializers/rails_settings_ui.rb_ b/config/initializers/rails_settings_ui.rb_ deleted file mode 100644 index e69311601d..0000000000 --- a/config/initializers/rails_settings_ui.rb_ +++ /dev/null @@ -1,30 +0,0 @@ -require 'rails-settings-ui' - -# Uncomment the following once we upgrade to a newer version of rails-settings-cached: -# -# # Compatibility with newer versions of rails-settings-cached -# module RailsSettingsUi -# class << self -# def default_settings -# settings = RailsSettingsUi.settings_klass.defaults -# settings.reject { |name, _description| ignored_settings.include?(name.to_sym) } -# end -# end -# end - -RailsSettingsUi.setup do |config| - # Specify a controller for RailsSettingsUi::ApplicationController to inherit from: - config.parent_controller = 'Admin::BaseController' # default: '::ApplicationController' - - config.settings_class = 'Settings::Db::Store' -end - -Rails.application.config.to_prepare do - # If you use a *custom layout*, make route helpers available to RailsSettingsUi: - # RailsSettingsUi.inline_engine_routes! - RailsSettingsUi::ApplicationController.module_eval do - # Render RailsSettingsUi inside a custom layout - # (set to 'application' to use app layout, default is RailsSettingsUi's own layout) - layout 'admin' - end -end diff --git a/config/routes.rb b/config/routes.rb index bbf8216f0f..612a4678e7 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -310,8 +310,6 @@ resources :external_ids, only: [:destroy] mount Blazer::Engine, at: "blazer", as: 'blazer_admin' - - #mount RailsSettingsUi::Engine, at: 'settings' end namespace 'dev' do diff --git a/lib/settings.rb_ b/lib/settings.rb similarity index 70% rename from lib/settings.rb_ rename to lib/settings.rb index e07bb9fc30..cc7cca6cb8 100644 --- a/lib/settings.rb_ +++ b/lib/settings.rb @@ -16,16 +16,6 @@ module Settings module Db class Store < RailsSettings::Base - source Rails.root.join("config/app.yml") - namespace Rails.env - - # Workaround (this method missing in current implementation, but RailsSettings-UI - # expects it -- doesn't really need to use it any more b/c RailsSettingsCached - # deals with defaults internally) - def self.defaults - result = RailsSettings::Default.enabled? ? RailsSettings::Default.instance : {} - result.with_indifferent_access - end end mattr_accessor :store