use secrets.yml to allow overriding config variables

This commit is contained in:
Devin Howard 2015-10-29 16:23:41 +08:00
parent cda76a4bae
commit 8e1ae0a1fc
4 changed files with 7 additions and 7 deletions

View file

@ -1,4 +1,4 @@
First off, Metamaps runs on Ruby On Rails. Ruby 2.1.3 and Rails 3.2. You'll need to get Ruby and Rails installed on your computer if you don't already have it. Go to here for Ruby http://rubyinstaller.org/downloads/ First off, Metamaps runs on Ruby On Rails. You'll need to get Ruby and Rails installed on your computer if you don't already have it. Go to here for Ruby http://rubyinstaller.org/downloads/
You'll also need GIT: http://git-scm.com/download/win You'll also need GIT: http://git-scm.com/download/win
@ -7,7 +7,7 @@ It uses postgreSQL 9.2 as a database. You can install that for your computer fro
Once you install those, open a 'command prompt with ruby'. Once you install those, open a 'command prompt with ruby'.
to install rails to install rails
gem install rails -v 3.2 gem install rails -v 4.2
also download node.js, which is also needed http://nodejs.org/download/ also download node.js, which is also needed http://nodejs.org/download/
@ -24,7 +24,7 @@ Install all the gems needed for Metamaps by running
Setting up the database: Setting up the database:
1) Copy /config/database.yml.default and rename the copy to /config/database.yml then edit database.yml with your text editor and set the password to whatever you chose when you set up the PostGres database. 1) Copy /config/database.yml.default and rename the copy to /config/database.yml then edit database.yml with your text editor and set the password to whatever you chose when you set up the PostGres database. Then do the same for /config/secrets.yml (the defaults should be OK for this file).
2) In a terminal: 2) In a terminal:

View file

@ -12,7 +12,7 @@ class Map < ActiveRecord::Base
:thumb => ['188x126#', :png] :thumb => ['188x126#', :png]
#:full => ['940x630#', :png] #:full => ['940x630#', :png]
}, },
:default_url => 'https://s3.amazonaws.com/metamaps-assets/site/missing-map.png' :default_url => Rails.secrets.missing_map_png_url
# Validate the attached image is image/jpg, image/png, etc # Validate the attached image is image/jpg, image/png, etc
validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/ validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/

View file

@ -35,7 +35,7 @@ class User < ActiveRecord::Base
:ninetysix => ['96x96#', :png], :ninetysix => ['96x96#', :png],
:onetwentyeight => ['128x128#', :png] :onetwentyeight => ['128x128#', :png]
}, },
:default_url => 'https://s3.amazonaws.com/metamaps-assets/site/user.png' :default_url => Rails.secrets.user_png_url
# Validate the attached image is image/jpg, image/png, etc # Validate the attached image is image/jpg, image/png, etc
validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/

View file

@ -1,6 +1,6 @@
defaults: &defaults defaults: &defaults
missing_map_png_url: '/assets/missing-map.png' missing_map_png_url: 'https://s3.amazonaws.com/metamaps-assets/site/missing-map.png'
user_png_url: '/assets/user.png' user_png_url: 'https://s3.amazonaws.com/metamaps-assets/site/user.png'
development: development:
<<: *defaults <<: *defaults