Sha256: 801b79bf1f8d32266be5a52fe733c7233dff69a48a25067414e5823106f86ef4
Contents?: true
Size: 1.04 KB
Versions: 15
Compression:
Stored size: 1.04 KB
Contents
class Fanforce::Plugin::Sinatra get '/internals/config.json' do file = File.open("#{Fanforce::Plugin.base_dir}/config.json") config = MultiJson.load(file.read, symbolize_keys: true) config[:iron_workers] ||= [] if params[:include_iron_credentials].to_i > 0 config[:iron_workers].each do |iron_worker| iron_worker[:project_id] = ENV['IRON_PROJECT_ID'] iron_worker[:token] = ENV['IRON_TOKEN'] end end config.to_json end post '/internals/config.json' do filename = "#{Fanforce::Plugin.base_dir}/config.json" file = File.open(filename) old_config = MultiJson.load(file.read, symbolize_keys: true) new_config = MultiJson.load(params[:config], symbolize_keys: true) raise 'IUIDs do not match' if old_config[:_iuid] and old_config[:_iuid] != new_config[:_iuid] File.open(filename, 'w') {|f| f.write(JSON.pretty_generate(Hash[new_config.sort]) + $RS) } json status: 'finished' end get '/plugin_factory/directives/:filename' do factory_directive(params[:filename]) end end
Version data entries
15 entries across 15 versions & 1 rubygems