Add rails-settings-cached, use for initial feature flags
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -13,7 +13,7 @@ class Admin::LightningController < Admin::BaseController
|
||||
end
|
||||
|
||||
def check_feature_enabled
|
||||
if ENV["LNDHUB_ADMIN_UI"].empty?
|
||||
if !Setting.lndhub_admin_enabled?
|
||||
flash[:alert] = "Lightning Admin UI not enabled"
|
||||
redirect_to admin_root_path and return
|
||||
end
|
||||
|
||||
7
app/models/setting.rb
Normal file
7
app/models/setting.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
# RailsSettings Model
|
||||
class Setting < RailsSettings::Base
|
||||
cache_prefix { "v1" }
|
||||
|
||||
field :lndhub_enabled, default: (ENV["LNDHUB_API_URL"].present?.to_s || "false"), type: :boolean
|
||||
field :lndhub_admin_enabled, default: (ENV["LNDHUB_ADMIN_UI"] || "false"), type: :boolean
|
||||
end
|
||||
@@ -6,7 +6,7 @@
|
||||
class: main_nav_class(@current_section, :invitations) %>
|
||||
<%= link_to "Donations", admin_donations_path,
|
||||
class: main_nav_class(@current_section, :donations) %>
|
||||
<% if ENV["LNDHUB_ADMIN_UI"] %>
|
||||
<% if Setting.lndhub_admin_enabled? %>
|
||||
<%= link_to "Lightning", admin_lightning_path,
|
||||
class: main_nav_class(@current_section, :lightning) %>
|
||||
<% end %>
|
||||
|
||||
Reference in New Issue
Block a user