From 570fa931b73f6386e1a7102bdbb8a8c3486d2f5b Mon Sep 17 00:00:00 2001 From: Devin Howard Date: Thu, 29 Oct 2015 16:23:41 +0800 Subject: [PATCH] use secrets.yml to allow overriding config variables --- WindowsInstallation.md | 6 +++--- app/models/map.rb | 2 +- app/models/user.rb | 2 +- config/secrets.yml.default | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/WindowsInstallation.md b/WindowsInstallation.md index 42364b44..25268772 100644 --- a/WindowsInstallation.md +++ b/WindowsInstallation.md @@ -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 @@ -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'. 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/ @@ -24,7 +24,7 @@ Install all the gems needed for Metamaps by running 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: diff --git a/app/models/map.rb b/app/models/map.rb index 75774df8..59f10f9f 100644 --- a/app/models/map.rb +++ b/app/models/map.rb @@ -12,7 +12,7 @@ class Map < ActiveRecord::Base :thumb => ['188x126#', :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 validates_attachment_content_type :screenshot, :content_type => /\Aimage\/.*\Z/ diff --git a/app/models/user.rb b/app/models/user.rb index f6b0d65a..ecd09fcd 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -35,7 +35,7 @@ class User < ActiveRecord::Base :ninetysix => ['96x96#', :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 validates_attachment_content_type :image, :content_type => /\Aimage\/.*\Z/ diff --git a/config/secrets.yml.default b/config/secrets.yml.default index 6859262d..eb35a382 100644 --- a/config/secrets.yml.default +++ b/config/secrets.yml.default @@ -1,6 +1,6 @@ defaults: &defaults - missing_map_png_url: '/assets/missing-map.png' - user_png_url: '/assets/user.png' + missing_map_png_url: 'https://s3.amazonaws.com/metamaps-assets/site/missing-map.png' + user_png_url: 'https://s3.amazonaws.com/metamaps-assets/site/user.png' development: <<: *defaults