Sha256: 65095b46d7346360ce8ee6cb6b9dc5414ab223235fff8255b0eb4bfd87a6df54

Contents?: true

Size: 983 Bytes

Versions: 3

Compression:

Stored size: 983 Bytes

Contents

module Bushido
  class EnvsController < ApplicationController
    # PUT /bushido/envs/:id
    def update
      if ENV["BUSHIDO_APP_KEY"] != params[:key] or params[:id] == "BUSHIDO_KEY"
        respond_to do |format|
          format.html { render :layout => false, :text => true, :status => :forbidden }
          format.json { render :status => :unprocessable_entity }
        end

      else

        ENV[params[:id]] = params[:value]
        @value = ENV[params[:id]]
        
        respond_to do |format|
          if @value != ENV[params[:id]]
            format.html{render :layout => false, :text => true, :status => :unprocessable_entity}
            format.json{render :status => :unprocessable_entity}
          else
            Bushido::Data.fire(params[:id], {params[:id] => ENV[params[:id]]})
            format.html{render :text => true}
            format.json{render :json => {params[:id] => ENV[params[:id]]}}
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
bushido-0.0.35 app/controllers/bushido/envs_controller.rb
bushido-0.0.34 app/controllers/bushido/envs_controller.rb
bushido-0.0.33 app/controllers/bushido/envs_controller.rb