Skip to content

Commit

Permalink
Update conf to use new format for environment vars
Browse files Browse the repository at this point in the history
  • Loading branch information
jtarchie committed Oct 1, 2012
1 parent 4c325c0 commit c3202fd
Showing 1 changed file with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -1,16 +1,26 @@
<%
require "uri"
if ENV['DATABASE_URL']
database_url = URI.parse(ENV['DATABASE_URL'])
ENV['DB_HOST'] = database_url.host
ENV['DB_NAME'] = database_url.path.sub(/^\//,'')
ENV['DB_USERNAME'] = database_url.user
ENV['DB_PASSWORD'] = database_url.password
end
%>
worker_processes 1;
events {
worker_connections 1024;
}
http {
upstream database {
postgres_server $ENV_DB_HOST
dbname=$ENV_DB_NAME
user=$ENV_DB_USERNAME
password=$ENV_DB_PASSWORD;
postgres_server <%= ENV['DB_HOST'] %>
dbname=<%= ENV['DB_NAME'] %>
user=<%= ENV['DB_USERNAME'] %>
password=<%= ENV['DB_PASSWORD'] %>;
}
server {
listen $ENV_PORT;
listen <%= ENV['PORT'] %>;

location /venues {
postgres_pass database;
Expand Down

0 comments on commit c3202fd

Please sign in to comment.