add demo configs

pull/105/head 0.0.2
Alex Turchyn 2 years ago
parent 8f97d2f6f7
commit 4234198b46

@ -4,6 +4,7 @@ class ApplicationController < ActionController::Base
include ActiveStorage::SetCurrent include ActiveStorage::SetCurrent
include Pagy::Backend include Pagy::Backend
before_action :sign_in_for_demo, if: -> { Docuseal.demo? }
before_action :maybe_redirect_to_setup, unless: :signed_in? before_action :maybe_redirect_to_setup, unless: :signed_in?
before_action :authenticate_user!, unless: :devise_controller? before_action :authenticate_user!, unless: :devise_controller?
@ -21,6 +22,10 @@ class ApplicationController < ActionController::Base
private private
def sign_in_for_demo
sign_in(User.first) unless signed_in?
end
def current_account def current_account
current_user&.account current_user&.account
end end

@ -23,6 +23,10 @@ module Docuseal
ENV['MULTITENANT'] == 'true' ENV['MULTITENANT'] == 'true'
end end
def demo?
ENV['DEMO'] == 'true'
end
def active_storage_public? def active_storage_public?
ENV['ACTIVE_STORAGE_PUBLIC'] == 'true' ENV['ACTIVE_STORAGE_PUBLIC'] == 'true'
end end

Loading…
Cancel
Save