Disable lndhub admin UI when not configured
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
parent
43f133ebd7
commit
b4c9b31ce7
@ -1,4 +1,6 @@
|
|||||||
class Admin::LightningController < Admin::BaseController
|
class Admin::LightningController < Admin::BaseController
|
||||||
|
before_action :check_feature_enabled
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@current_section = :lightning
|
@current_section = :lightning
|
||||||
|
|
||||||
@ -9,4 +11,11 @@ class Admin::LightningController < Admin::BaseController
|
|||||||
@ln[:current_balance] = LndhubAccount.current.joins(:ledgers).sum("account_ledgers.amount")
|
@ln[:current_balance] = LndhubAccount.current.joins(:ledgers).sum("account_ledgers.amount")
|
||||||
@ln[:users_with_sats] = @accounts.length
|
@ln[:users_with_sats] = @accounts.length
|
||||||
end
|
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
|
end
|
||||||
|
@ -6,5 +6,7 @@
|
|||||||
class: main_nav_class(@current_section, :invitations) %>
|
class: main_nav_class(@current_section, :invitations) %>
|
||||||
<%= link_to "Donations", admin_donations_path,
|
<%= link_to "Donations", admin_donations_path,
|
||||||
class: main_nav_class(@current_section, :donations) %>
|
class: main_nav_class(@current_section, :donations) %>
|
||||||
<%= link_to "Lightning", admin_lightning_path,
|
<% if ENV["LNDHUB_ADMIN_UI"] %>
|
||||||
class: main_nav_class(@current_section, :lightning) %>
|
<%= link_to "Lightning", admin_lightning_path,
|
||||||
|
class: main_nav_class(@current_section, :lightning) %>
|
||||||
|
<% end %>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user