Disable lndhub admin UI when not configured
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Râu Cao
2023-02-13 21:57:06 +08:00
parent 43f133ebd7
commit b4c9b31ce7
2 changed files with 13 additions and 2 deletions

View File

@@ -1,4 +1,6 @@
class Admin::LightningController < Admin::BaseController
before_action :check_feature_enabled
def index
@current_section = :lightning
@@ -9,4 +11,11 @@ class Admin::LightningController < Admin::BaseController
@ln[:current_balance] = LndhubAccount.current.joins(:ledgers).sum("account_ledgers.amount")
@ln[:users_with_sats] = @accounts.length
end
def check_feature_enabled
if ENV["LNDHUB_ADMIN_UI"].empty?
flash[:alert] = "Lightning Admin UI not enabled"
redirect_to admin_root_path and return
end
end
end