Class | ServerSpecificationController |
In: |
app/controllers/server_specification_controller.rb
|
Parent: | ApplicationController |
This method is used to disable the ssl support.
# File app/controllers/server_specification_controller.rb, line 26 26: def disable_ssl_support 27: info = YAML::load_file(CONFIG_FILE_PATH) rescue nil 28: ssl_specification = Hash['ssl_support' => 'disabled', 29: 'certificate_file' => info['Server Specification']['SSL Specification']['certificate'], 30: 'key_file' => info['Server Specification']['SSL Specification']['key'], 31: 'ssl_port' => info['Server Specification']['SSL Specification']['port']] 32: server_specification = Hash['port' => info['Server Specification']['port'], 33: 'log_level' => info['Server Specification']['log_level'], 34: 'min_worker' => info['Server Specification']['min_worker'], 35: 'max_worker' => info['Server Specification']['max_worker'], 36: 'SSL Specification' => ssl_specification] 37: ServerSpecification.write(info, server_specification) 38: redirect_to configuration_path 39: end
This method is used to enable the ssl support.
# File app/controllers/server_specification_controller.rb, line 42 42: def enable_ssl_support 43: info= YAML::load_file(CONFIG_FILE_PATH) rescue nil 44: str = check_for_ssl_validation(params[:ssl]) 45: if str.length == 0 46: ssl_specification = Hash['ssl_support' => 'enabled', 47: 'certificate_file' => params[:ssl][:certificate_path], 48: 'key_file' => params[:ssl][:key_path], 49: 'ssl_port' => params[:ssl][:port]] 50: server_specification = Hash['port' => info['Server Specification']['port'], 51: 'log_level' => info['Server Specification']['log_level'], 52: 'min_worker' => info['Server Specification']['min_worker'], 53: 'max_worker' => info['Server Specification']['max_worker'], 54: 'SSL Specification' => ssl_specification] 55: ServerSpecification.write(info, server_specification) 56: flash[:error] = RESTART_SERVER_MESSAGE 57: redirect_to configuration_path 58: else 59: flash[:ssl_errors] = str 60: redirect_to :controller => 'admin', :action=>'configuration', :ssl => params[:ssl] 61: end 62: end
This function is to add server specification. This action is used to save the changes made through configuration page.
# File app/controllers/server_specification_controller.rb, line 72 72: def save_data 73: text = params[:old_value].to_s 74: if !params[:data][:value].empty? 75: text, error_message = ServerSpecification.validate_and_write( params[:div_id], params[:data][:value]) 76: if error_message.length > 0 77: render :text => text.to_s + " <span id='error_div'>#{error_message}</span>" 78: else 79: render :text => text.to_s + " <span id='error_div'>#{RESTART_SERVER_MESSAGE}</span>" 80: end 81: end 82: end
This method is to render ssl_support_form partial
# File app/controllers/server_specification_controller.rb, line 65 65: def ssl_support_form 66: @ssl_spec = Hash[:certificate_path => "", :key_path => "", :port => 443] 67: render :partial => 'ssl_support_form' 68: end