Skip to content

Commit d5e8f32

Browse files
committed
Converting from using Figaro to using Dotenv
1 parent 02c89aa commit d5e8f32

File tree

6 files changed

+65
-19
lines changed

6 files changed

+65
-19
lines changed

.env.example

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
DISCOUNT_TOKEN=discount_token
2+
3+
GITHUB_ADMIN_USER=github_admin_user
4+
GITHUB_ADMIN_USER_PASSWORD=github_admin_user_password
5+
GITHUB_CLIENT_ID=github_client_id
6+
GITHUB_REDIRECT_URL=http://localhost:3000/auth/github/callback
7+
GITHUB_SECRET=github_secret
8+
9+
LANG=en_US.UTF-8
10+
LC_ALL=en_US.UTF-8
11+
12+
LINKEDIN_KEY=linkedin_key
13+
LINKEDIN_SECRET=linkedin_secret
14+
15+
MAILGUN_API_KEY=key-mailgun_api_key
16+
MAILGUN_DOMAIN=localhost
17+
MAILGUN_SIGNATURE=mailgun_signature
18+
MAILGUN_TOKEN=mailgun_token
19+
20+
MIXPANEL_API_SECRET=mixpanel_api_secret
21+
MIXPANEL_TOKEN=mixpanel_token
22+
23+
MONGODB_DATABASE_NAME=coderwall
24+
25+
NOTIFIER_ADMIN_EMAILS="['notifier_admin@example.com']"
26+
27+
PRIVATE_ADMIN_PATH=private_admin_path
28+
PRIVATE_URL=http://development:development@localhost:3000
29+
30+
REDIS_URL=redis://localhost:6379
31+
32+
REVIEWERS="['Administrator']"
33+
34+
STRIPE_PUBLISHABLE_KEY=pk_test_stripe_publishable_key
35+
STRIPE_SECRET_KEY=sk_test_stripe_secret_key
36+
37+
SUPPORT_EMAIL=support@example.com
38+
39+
TWITTER_ACCOUNT_ID=111111111
40+
TWITTER_CONSUMER_KEY=twitter_consumer_key
41+
TWITTER_CONSUMER_SECRET=twitter_consumer_secret
42+
TWITTER_OAUTH_SECRET=twitter_oauth_secret
43+
TWITTER_OAUTH_TOKEN=twitter_oauth_token
44+
TWITTER_REDIRECT_URL=http://localhost:3000/auth/twitter/callback

.gitignore

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
2+
# Ignore application configuration
13
*.dat
24
*.gem
35
*.rbc
@@ -6,12 +8,12 @@
68
.bundle
79
.config
810
.env
9-
.env.*
1011
.idea
1112
.sass-cache
1213
.vagrant
1314
.yardoc
1415
/.bundle
16+
/config/application.yml
1517
/db/*.sqlite3
1618
/db/*.sqlite3-journal
1719
/log/*.log
@@ -32,6 +34,7 @@ log/*.log
3234
logfile
3335
nlp.rb
3436
pkg
37+
public/assets/
3538
public/images/top/
3639
rdoc
3740
script/env
@@ -42,13 +45,8 @@ test/tmp
4245
test/version_tmp
4346
tmp
4447
vagrant/cache
45-
vagrant/dotfiles
46-
vcr_cassettes
47-
public/assets/
48-
49-
vagrant/coderwall-box/packer_cache/
5048
vagrant/coderwall-box/output-virtualbox-iso/
49+
vagrant/coderwall-box/packer_cache/
5150
vagrant/coderwall-box/packer_virtualbox-iso_virtualbox.box
52-
53-
# Ignore application configuration
54-
/config/application.yml
51+
vagrant/dotfiles
52+
vcr_cassettes

Gemfile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ ruby '2.1.0'
44

55
gem 'rails', '~> 3.2'
66

7+
# Load environment variables first
8+
gem 'dotenv-rails', groups: [:development, :test]
9+
710
gem 'strong_parameters'
811

912
# Mongo
@@ -95,9 +98,6 @@ gem 'oj'
9598
gem 'active_model_serializers'
9699
gem 'jbuilder'
97100

98-
# Environment variable configuration management
99-
gem 'figaro'
100-
101101
# Run app
102102
gem 'foreman'
103103

Gemfile.lock

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,8 @@ GEM
146146
diffy (3.0.1)
147147
docile (1.1.3)
148148
dotenv (0.10.0)
149+
dotenv-rails (0.10.0)
150+
dotenv (= 0.10.0)
149151
eco (1.0.0)
150152
coffee-script
151153
eco-source
@@ -181,9 +183,6 @@ GEM
181183
loofah (~> 1.2.1)
182184
sax-machine (~> 0.2.1)
183185
ffi (1.9.3)
184-
figaro (0.7.0)
185-
bundler (~> 1.0)
186-
rails (>= 3, < 5)
187186
fog (0.7.2)
188187
builder
189188
excon (>= 0.6.1)
@@ -633,11 +632,11 @@ DEPENDENCIES
633632
createsend
634633
dalli
635634
database_cleaner
635+
dotenv-rails
636636
ember-rails!
637637
fabrication (= 1.4.1)
638638
faker
639639
feedjira
640-
figaro
641640
fog
642641
font_assets (~> 0.1.2)
643642
foreman

app/models/github_badge.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
class GithubBadge
22
def initialize
3-
@client = Octokit::Client.new(login: ENV['GITHUB_ADMIN_USER'], password: ENV['GITHUB_ADMIN_USER_PASSWORD'], client_id: ENV['GITHUB_CLIENT_ID'], client_secret: ENV['GITHUB_SECRET'])
3+
@client = Octokit::Client.new(
4+
login: ENV['GITHUB_ADMIN_USER'],
5+
password: ENV['GITHUB_ADMIN_USER_PASSWORD'],
6+
client_id: ENV['GITHUB_CLIENT_ID'],
7+
client_secret: ENV['GITHUB_SECRET']
8+
)
49
rescue Exception => e
510
Rails.logger.error("Failed to initialize octokit: #{e.message}")
611
end

spec/models/purchased_bundle_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
require 'spec_helper'
3030

3131
describe PurchasedBundle do
32-
3332
it 'should split purchase amount on creation', functional: true do
3433
purchase = create_test_bundle(amount = 6000)
3534
purchase.codeschool_proceeds.should == 3477 #3600
@@ -51,7 +50,8 @@
5150

5251
it 'should put stripe message into errors if charge unsucessful', functional: true do
5352
purchase = create_test_bundle(amount = 2000, bad_token = 'this-is-bogus')
54-
purchase.errors.full_messages.should include("Unable to charge card. Please contact us at support@coderwall.com if you continue to have issues.")
53+
expected_message = "Unable to charge card. Please contact us at support@coderwall.com if you continue to have issues."
54+
purchase.errors.full_messages.should include(expected_message)
5555
end
5656

5757
def create_test_bundle(amount, token = PurchasedBundle.create_test_token)

0 commit comments

Comments
 (0)