Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Environment-specific database URL support

  • Loading branch information...
commit a0d05fa3f0c2af6b82b834c60a9c057cfb022360 1 parent 5ddc79d
@6 authored
Showing with 4 additions and 3 deletions.
  1. +3 −2 config.yml
  2. +1 −1  server/application.rb
View
5 config.yml
@@ -3,5 +3,6 @@
session_secret: "replace_me"
# URL of postgres database (optional). Example:
-# database_url: "postgres://postgres@localhost/sinatra_backbone_development"
-database_url:
+# database_url_development: "postgres://postgres@localhost/sinatra_backbone_development"
+database_url_development:
+database_url_test:
View
2  server/application.rb
@@ -6,7 +6,7 @@
Config = YAML.load_file('config.yml')
ENV['RACK_ENV'] ||= 'development'
-ENV['DATABASE_URL'] ||= Config['database_url']
+ENV['DATABASE_URL'] ||= Config["database_url_#{ENV['RACK_ENV']}"]
if ENV['DATABASE_URL']
require 'sinatra/activerecord'
Please sign in to comment.
Something went wrong with that request. Please try again.