Skip to content

Commit

Permalink
изменения для параметра static . теперь он может быть массивом
Browse files Browse the repository at this point in the history
  • Loading branch information
melezhik committed Aug 16, 2012
1 parent b8b277c commit af9bd6c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
8 changes: 4 additions & 4 deletions nginx-fastcgi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ The definition takes the following parameters:

* name: specifies a single path (string) where nginx site config will be installed. No default, this must be specified.
* socket: specifies the port or socket on which the FastCGI-server is listening. No default, this must be specified.
See http://wiki.nginx.org/HttpFastcgiModule#fastcgi_pass for details.
* static: specifies location of static files (not handled by application, but nginx), is either array or hash with following keys:
Check out http://wiki.nginx.org/HttpFastcgiModule#fastcgi_pass for details.
* static: specifies location of static files (not handled by application, but nginx), is the Array of Hashes or hash with following keys:
* location
* root
* servers: specifies all virtual hosts to be included into site config, is the array of hashes with following keys:
* servers: specifies all virtual hosts to be included into site config, is an Array of Hashes with following keys:
* ip
* server_name
* ssl
Expand All @@ -29,7 +29,7 @@ The definition takes the following parameters:
* redirect
* cookbook: specifies the cookbook name where template source comes from. By default it will use the cookbook where the definition is used.
* fastcgi_param: specifies additional fastcgi_params to be included into location block
* error_page - specifies custom error pages. Is the array of hashes with following keys (See http://wiki.nginx.org/HttpCoreModule#error_page for details):
* error_page - specifies custom error pages. Is an Array of Hashes with following keys (check out http://wiki.nginx.org/HttpCoreModule#error_page for details):
* code
* handler

Expand Down
3 changes: 1 addition & 2 deletions nginx-fastcgi/changes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
0.0.8
===
- new parameter - `error_page`
-

- `static` may be an Array

0.0.7
===
Expand Down
4 changes: 2 additions & 2 deletions nginx-fastcgi/definitions/nginx_fastcgi.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
define :nginx_fastcgi, :servers => [], :root => nil, :static => nil, :fastcgi_param => [], :error_page => [] do
define :nginx_fastcgi, :servers => [], :root => nil, :static => [], :fastcgi_param => [], :error_page => [] do

if params[:socket].nil? || params[:socket].empty?
message = 'you should setup socket param. '
Expand Down Expand Up @@ -29,7 +29,7 @@
cookbook params[:cookbook] || 'nginx-fastcgi'
mode 0664
variables({
:static => params[:static],
:static => ( (params[:static].is_a? Hash) ? [params[:static]] : params[:static] ),
:root => params[:root],
:socket => params[:socket],
:servers => params[:servers],
Expand Down
6 changes: 4 additions & 2 deletions nginx-fastcgi/templates/default/nginx-site.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@ server {
<%- end %>

<%- unless @static.nil? || @static.empty? %>
location <%= @static[:location] %> {
root <%= @static[:root] %>;
<%- @static.each do |item| %>
location <%= item[:location] %> {
root <%= item[:root] %>;
}
<%- end %>
<%- end %>

<%- if s[:ssl] == true %>
Expand Down

0 comments on commit af9bd6c

Please sign in to comment.