Last post I've added a module attribute for the spree backend for supplying the configuration data.
I think it's much cleaner to use Spree's build in configuration system.
The admin path now is a normal Spree setting. You can supply it in the Spree initializer:
Spree.config do |config| config.admin_path = "/super-secret-name" end
The code changes required in Spree for this solution only is 3 lines!
Add the admin_path preference to this file core/app/models/spree/app_configuration.rb
module Spree class AppConfiguration < Preferences::Configuration #... preference :admin_path, :string, default: "/admin" #... end end
And alter the backend/config/routes.rb, to include a path definition in the top namespace and change the '/admin' path route of the last line.
Spree::Core::Engine.add_routes do namespace :admin, path: Spree::Config.admin_path do #.. everything remains the same, except this last line: get Spree::Config.admin_path, to: 'admin/root#index', as: :admin end end
That's all...
Sending in a PullRequest now :)