src/admin_panel/lib/yaml_writer.rb in webroar-0.3.1 vs src/admin_panel/lib/yaml_writer.rb in webroar-0.4.0

- old
+ new

@@ -16,19 +16,26 @@ # # You should have received a copy of the GNU General Public License # along with WebROaR. If not, see <http://www.gnu.org/licenses/>. #++ +module YAMLConfig + CONFIG = 1 + USER = 2 + SMTP = 3 + SENDMAIL = 4 +end + class YAMLWriter class << self #This method is to write the data into the yaml file. #The method is used to write config.yml as well as user.yml file. def write(hash, file_path, type) yaml_obj = YAML::dump(hash) file = File.open(file_path,"w") - if type == "config" + if type == YAMLConfig::CONFIG header_string = get_header() file.puts(header_string) end file.puts(yaml_obj) file.close @@ -83,10 +90,13 @@ # 7) Minimum number of workers(optional)(default is 'Server Specification/min_worker') # 8) Maximum number of workers(optional)(default is 'Server Specification/max_worker') # 9) Logging level(optional)(default is 'Server Specification/log_level') # 10) Run as user (mandatory) # 11) Hostnames(optional) +# 12) Environment Variable(optional) +# It defines environment variables which can be used in the deployed application. It take following parameter. +# I) set_env(optional)(Value is key-value pair separated by equal sign('=') e.g. LOG_DIR=/var/log/webroar) # Order of the above elements does not matter. # Base-uri 'admin-panel' is reserved for 'Admin Panel'. # Either host_names or baseuri(not both) must present to resolve HTTP request. # Hostnames can have multiple values, each separated by spaces.(e.g. host_names: server.com server.co.in) # Hostnames can be defined using wildcard(*), but wildcard can only be at start of name or at end of name (valid hostnames are (i) *.server.com (ii) www.server.* (iii) *.server.*). @@ -101,10 +111,13 @@ # analytics: enabled # environment: production # min_worker: 2 # max_worker: 5 # log_level: SEVERE +# environment_variables: +# - set_env: LOG_DIR=/var/log/webroar +# - set_env: TMP_DIR=/tmp # Example with host_names: # Application Specification: # - name: Mephisto # host_names: myblog.com ~*.myblog.com # path: /home/smartuser/work/rails_workspace/mephisto @@ -113,26 +126,47 @@ # analytics: enabled # environment: production # min_worker: 2 # max_worker: 5 # log_level: SEVERE -# (c) Headers (optional) -# It allows adding or changing the Expires and Cache-Control in the response headers for static assets (e.g. *.js, *.gif etc). -# Elements: -# 1) Expires header for all static assets (optional) (default is 'off') -# 2) Specific expires header for specific file types (optional) -# Elements: -# I) File Extensions(mandatory) -# II) Expires value(mandatory) (No of seconds) -# Possible value for expires is off or no. of seconds. -# Example: -# Headers: -# expires: 3600 -# expires_by_type: -# - ext: png, jpg, gif -# expires: 31536000 +# environment_variables: +# - set_env: LOG_DIR=/var/log/webroar +# - set_env: TMP_DIR=/tmp # +# (c) Headers (optional) +# It allows adding or changing the Expires and Cache-Control in the response headers for static assets (e.g. *.js, *.gif etc). +# Elements: +# 1) Expires header for all static assets (optional) (default is 'off') +# 2) Specific expires header for specific file types (optional) +# Elements: +# I) File Extensions(mandatory) +# II) Expires value(mandatory) (No of seconds) +# Possible value for expires is off or no. of seconds. +# Example: +# Headers: +# expires: 3600 +# expires_by_type: +# - ext: png, jpg, gif +# expires: 31536000 +# +# (d) Encoding (optional) +# It allows (deflate) encoding of static assets. +# Elements: +# 1) Regex value for supported Content-Type (optional) (default is 'text|xml') +# 2) Regex value for supported Used-Agent (optional) (default is '.*') +# 3) Range of Content-Length (optional) +# Elements: +# I) Lower limit of Content-Length (optional) (default is 1024 i.e. 1KB) +# II) Upper limit of Content-Length (optional) (default is 12328960 i.e. 10MB) +# Example: +# Encoding: +# Content-Type: text|xml|javascript +# User-Agent: .* +# Size Limit: +# lower_limit: 2094 +# upper_limit: 12328960 +# ######################################################################################" end end -end \ No newline at end of file +end #end YAMLWriter