diff --git a/.gitignore b/.gitignore index 8a8fe78..f11e40a 100644 --- a/.gitignore +++ b/.gitignore @@ -54,3 +54,6 @@ application.yml # Ignore Byebug command history file. .byebug_history + +# Ignore application configuration +/config/application.yml diff --git a/Gemfile b/Gemfile index d17b9b7..0f574db 100644 --- a/Gemfile +++ b/Gemfile @@ -1,6 +1,7 @@ source 'https://rubygems.org' gem 'figaro', '~> 1.1.1' +gem 'settingslogic', '~> 2.0.9' gem 'bcrypt', '~> 3.1.7' gem 'mysql2', '>= 0.3.18', '< 0.5' gem 'rails', '~> 5.0.0' diff --git a/Gemfile.lock b/Gemfile.lock index d2ed7ea..54d643d 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -209,6 +209,7 @@ GEM sprockets (>= 2.8, < 4.0) sprockets-rails (>= 2.0, < 4.0) tilt (>= 1.1, < 3) + settingslogic (2.0.9) shellany (0.0.1) slop (3.6.0) spring (1.7.2) @@ -274,6 +275,7 @@ DEPENDENCIES rails-erd rubocop (~> 0.42.0) sass-rails (~> 5.0) + settingslogic (~> 2.0.9) spring spring-watcher-listen (~> 2.0.0) turbolinks (~> 5) diff --git a/app/services/skill_config.rb b/app/services/skill_config.rb new file mode 100644 index 0000000..6f3c718 --- /dev/null +++ b/app/services/skill_config.rb @@ -0,0 +1,6 @@ +class SkillConfig < Settingslogic + source "#{Rails.root}/config/application.yml" + namespace Rails.env + suppress_errors Rails.env.production? + load! +end diff --git a/config/application.yml.sample b/config/application.yml.sample new file mode 100644 index 0000000..506166b --- /dev/null +++ b/config/application.yml.sample @@ -0,0 +1,21 @@ +# Add configuration values here, as shown below. + +defaults: &defaults + mysql_host: "localhost" + mysql_usr: "user" + mysql_pwd: "password" + mailjet_key: "api-key" + mailjet_secret: "api-secret" + default_mail_from: "skills-assessment@dev.perficientxd.com" + +development: + <<: *defaults + +test: + <<: *defaults + +production: + <<: *defaults + mysql_usr: "user" + mysql_pwd: "password!" + secret_key_base: "super-long-secret-key-base" diff --git a/config/database.yml b/config/database.yml index b60aa35..c20b9ea 100644 --- a/config/database.yml +++ b/config/database.yml @@ -13,9 +13,9 @@ default: &default adapter: mysql2 encoding: utf8 pool: 5 - username: root - password: root - host: localhost + host: <%= ENV['mysql_host'] %> + username: <%= ENV['mysql_usr'] %> + password: <%= ENV['mysql_pwd'] %> development: <<: *default @@ -50,5 +50,5 @@ test: production: <<: *default database: skill-assessment-app_production - username: skill-assessment-app - password: <%= ENV['SKILL-ASSESSMENT-APP_DATABASE_PASSWORD'] %> + username: <%= ENV['mysql_usr'] %> + password: <%= ENV['mysql_pwd'] %>