diff --git a/.env b/.env new file mode 100644 index 000000000..e69de29bb diff --git a/.gitignore b/.gitignore index caa3d7177..030d739c4 100644 --- a/.gitignore +++ b/.gitignore @@ -19,3 +19,6 @@ /log/* !/log/.keep /tmp + +my.env + diff --git a/Gemfile b/Gemfile index f53d742a5..dc17220c6 100644 --- a/Gemfile +++ b/Gemfile @@ -13,6 +13,7 @@ gem 'pg' gem 'rails_12factor' gem 'rails_admin' gem 'validates_formatting_of' +gem 'forecast_io' platforms :ruby_18 do gem 'fastercsv' @@ -29,6 +30,7 @@ end group :development, :test do gem 'pry' + gem 'dotenv-rails' end group :production do diff --git a/Gemfile.lock b/Gemfile.lock index f78d66046..ae6b95b8f 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -67,17 +67,27 @@ GEM thread_safe (~> 0.1) warden (~> 1.2.3) docile (1.1.5) + dotenv (1.0.2) + dotenv-rails (1.0.2) + dotenv (= 1.0.2) erubis (2.7.0) execjs (2.2.2) + faraday (0.9.1) + multipart-post (>= 1.2, < 3) fastercsv (1.5.5) font-awesome-rails (4.3.0.0) railties (>= 3.2, < 5.0) + forecast_io (2.0.0) + faraday + hashie + multi_json geokit (1.9.0) multi_json (>= 1.3.2) globalid (0.3.0) activesupport (>= 4.1.0) haml (4.0.6) tilt + hashie (3.3.2) hike (1.2.3) http_accept_language (2.0.5) i18n (0.7.0) @@ -100,6 +110,7 @@ GEM mini_portile (0.6.2) minitest (5.5.1) multi_json (1.10.1) + multipart-post (2.0.0) nested_form (0.3.2) netrc (0.10.2) nokogiri (1.6.6.2) @@ -232,7 +243,9 @@ DEPENDENCIES arel coveralls devise + dotenv-rails fastercsv + forecast_io geokit haml http_accept_language diff --git a/README.md b/README.md index adb15319d..1c7f8216e 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,11 @@ You can see a running version of the application at This application requires [Postgres](http://www.postgresql.org/) to be installed git clone git://github.com/codeforamerica/adopt-a-hydrant.git + +_Note: if Git appears to hang or outright fails, try:_ + + git clone git@github.com:codeforamerica/adopt-a-hydrant.git + cd adopt-a-hydrant bundle install diff --git a/config/environments/development.rb b/config/environments/development.rb index e0e0ea829..ecd4edd2e 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -1,3 +1,6 @@ +require 'dotenv' +Dotenv.load '.env', 'my.env' + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/config/environments/test.rb b/config/environments/test.rb index 5c6dadfee..039935a5e 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -1,3 +1,6 @@ +require 'dotenv' +Dotenv.load '.env', 'my.env' + Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. diff --git a/config/initializers/forecast_io.rb b/config/initializers/forecast_io.rb new file mode 100644 index 000000000..1c798a709 --- /dev/null +++ b/config/initializers/forecast_io.rb @@ -0,0 +1,3 @@ +ForecastIO.configure do |configuration| + configuration.api_key = ENV['FORECAST_IO_API_KEY'] +end diff --git a/my-template.env b/my-template.env new file mode 100644 index 000000000..41a5f5e03 --- /dev/null +++ b/my-template.env @@ -0,0 +1,7 @@ +# Template for my.env file + +# Rename this file to .env, and set the envirionment variables to your specific values. +# This file will be ignored by Git, once renamed. + + +FORECAST_IO_API_KEY="Get a key from https://developer.forecast.io/" \ No newline at end of file