This gem handles figuring out which tenant is being used and adds that information .
Add this line to your application's Gemfile:
gem "atomic_tenant"
And then execute:
$ bundle
Or install it yourself as:
$ gem install atomic_tenant
Then install the migrations: ./bin/rails atomic_tenant:install:migrations
Create a new initializer:
config/initializers/atomic_tenant.rb
With the following content:
AtomicTenant.jwt_secret = Rails.application.secrets.auth0_client_secret
AtomicTenant.jwt_aud = Rails.application.secrets.auth0_client_id
AtomicTenant.admin_subdomain = "admin".freeze
The gem is available as open source under the terms of the MIT License.