chore: Add display manifest to whitelabel settings (#8708)

- Adds display manifest to white label settings
- Improve the app config rendering with options for display name and description
This commit is contained in:
Sojan Jose
2024-01-15 21:50:23 -08:00
committed by GitHub
parent 52a5a59ddb
commit 316cf35795
6 changed files with 58 additions and 10 deletions

View File

@@ -26,12 +26,13 @@ class ConfigLoader
reconcile_feature_config
end
private
def general_configs
@config_path ||= Rails.root.join('config')
@general_configs ||= YAML.safe_load(File.read("#{@config_path}/installation_config.yml")).freeze
end
private
def account_features
@account_features ||= YAML.safe_load(File.read("#{@config_path}/features.yml")).freeze
end

View File

@@ -12,6 +12,7 @@ class GlobalConfig
config[config_key] = load_from_cache(config_key)
end
typecast_config(config)
config.with_indifferent_access
end
@@ -28,6 +29,14 @@ class GlobalConfig
private
def typecast_config(config)
general_configs = ConfigLoader.new.general_configs
config.each do |config_key, config_value|
config_type = general_configs.find { |c| c['name'] == config_key }&.dig('type')
config[config_key] = ActiveRecord::Type::Boolean.new.cast(config_value) if config_type == 'boolean'
end
end
def load_from_cache(config_key)
cache_key = "#{VERSION}:#{KEY_PREFIX}:#{config_key}"
cached_value = $alfred.with { |conn| conn.get(cache_key) }