Add support for a button_config.url. Fixes #85

This commit is contained in:
Eric Schultz 2018-07-24 16:32:27 -05:00
parent 26166477fa
commit 612e2c56ec
2 changed files with 9 additions and 1 deletions

View file

@ -282,6 +282,11 @@ Config.schema do
end end
#the url for your button. As a default, it takes what's in CDN.url
optional(:button_domain).schema do
required(:url).filled?(:str)
end
end end
Settings.reload! Settings.reload!

View file

@ -12,10 +12,13 @@ namespace :settings do
end end
task :generate_json => :environment do task :generate_json => :environment do
cdn_url= URI(Settings.cdn.url) cdn_url= URI(Settings.cdn.url)
cdn_url.port = Settings.cdn.port if Settings.cdn.port cdn_url.port = Settings.cdn.port if Settings.cdn.port
cdn_url = cdn_url.to_s cdn_url = cdn_url.to_s
if (Settings.button_config.url)
cdn_url= URI(Settings.button_config.url).to_s
end
c = {button:{url:cdn_url,css:"#{cdn_url}/css/donate-button.v2.css"}} c = {button:{url:cdn_url,css:"#{cdn_url}/css/donate-button.v2.css"}}
open(File.expand_path('config/settings.json', Rails.root), 'w') do |f| open(File.expand_path('config/settings.json', Rails.root), 'w') do |f|
f.write(c.to_json) f.write(c.to_json)