diff --git a/.env.example b/.env.example index 7b29f7b2..8f844b35 100644 --- a/.env.example +++ b/.env.example @@ -20,8 +20,6 @@ MAILGUN_TOKEN=mailgun_token MIXPANEL_API_SECRET=mixpanel_api_secret MIXPANEL_TOKEN=mixpanel_token -MONGODB_DATABASE_NAME=coderwall - NOTIFIER_ADMIN_EMAILS="['notifier_admin@example.com']" PRIVATE_ADMIN_PATH=private_admin_path @@ -32,7 +30,7 @@ REDIS_URL=redis://localhost:6379 REVIEWERS="['Administrator']" STRIPE_PUBLISHABLE_KEY=pk_test_stripe_publishable_key -STRIPE_SECRET_KEY=sk_test_stripe_secret_key +STRIPE_SECRET_KEY=sk_test_BQokikJOvBiI2HlWgH4olfQ2 SUPPORT_EMAIL=support@example.com diff --git a/.gitignore b/.gitignore index 2d9a17c9..2d4dfbdb 100644 --- a/.gitignore +++ b/.gitignore @@ -7,7 +7,7 @@ .DS_Store .bundle .config -.env +*.env .idea .sass-cache .vagrant diff --git a/Vagrantfile b/Vagrantfile index 78cf99dc..73cfbbca 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -36,14 +36,21 @@ Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.network :forwarded_port, guest: 9292, host: 9293, auto_correct: true config.vm.synced_folder '.', '/home/vagrant/web', nfs: true - config.vm.synced_folder './vagrant', '/home/vagrant/provision', nfs: true - config.vm.synced_folder './vagrant/dotfiles', '/home/vagrant/dotfiles', nfs: true + # config.vm.synced_folder './vagrant', '/home/vagrant/provision', nfs: true + # config.vm.synced_folder './vagrant/dotfiles', '/home/vagrant/dotfiles', nfs: true config.vm.provider :virtualbox do |vb| vb.customize ['modifyvm', :id, '--cpus', '4'] vb.customize ['modifyvm', :id, '--ioapic', 'on'] vb.customize ['modifyvm', :id, '--memory', '4096'] + + # https://github.com/mitchellh/vagrant/issues/1807 + # whatupdave: my VM was super slow until I added these: + vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"] + vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"] + # seems to be safe to run: https://github.com/griff/docker/commit/e5239b98598ece4287c1088e95a2eaed585d2da4 end + config.vbguest.auto_update = true config.vbguest.no_remote = false end diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 5551a6ee..9235f8df 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -17,7 +17,8 @@ def create @account = @team.build_account(params[:account]) @account.admin_id = current_user.id - @account.trial_end = Date.new(2013, 1, 1).to_time.to_i if session[:discount] == ENV['DISCOUNT_TOKEN'] + # TODO: (whatupdave) this doesn't look like it's being used any more. Remove if possible + # @account.trial_end = Date.new(2013, 1, 1).to_time.to_i if session[:discount] == ENV['DISCOUNT_TOKEN'] if @account.save_with_payment(@plan) unless @team.is_member?(current_user) diff --git a/app/models/protip.rb b/app/models/protip.rb index d66e1099..a6cb55bc 100644 --- a/app/models/protip.rb +++ b/app/models/protip.rb @@ -401,7 +401,13 @@ def already_created_a_protip_for(url) end def valid_reviewers - Rails.cache.fetch('valid_protip_reviewers', expires_in: 1.month) { User.where(username: YAML.load(ENV['REVIEWERS'])).all } + Rails.cache.fetch('valid_protip_reviewers', expires_in: 1.month) do + if ENV['REVIEWERS'] + User.where(username: YAML.load(ENV['REVIEWERS'])).all + else + [] + end + end end end diff --git a/config/application.rb b/config/application.rb index e3e3eb87..2b601c99 100644 --- a/config/application.rb +++ b/config/application.rb @@ -33,6 +33,8 @@ class Application < Rails::Application config.ember.variant = Rails.env.downcase.to_sym config.assets.js_compressor = :uglifier + config.logger = Logger.new(STDOUT) + config.logger.level = Logger.const_get(ENV['LOG_LEVEL'] ? ENV['LOG_LEVEL'].upcase : 'INFO') config.after_initialize do if %w{development test}.include?(Rails.env) diff --git a/config/environments/development.rb b/config/environments/development.rb index 2b9a4f09..3d2aeb24 100644 --- a/config/environments/development.rb +++ b/config/environments/development.rb @@ -6,7 +6,7 @@ config.active_support.deprecation = :log config.assets.compile = true config.assets.compress = false - config.assets.debug = true + config.assets.debug = false config.cache_classes = false config.consider_all_requests_local = true config.host = 'localhost:3000' diff --git a/config/mongoid.yml b/config/mongoid.yml index fa80f07f..5035d066 100644 --- a/config/mongoid.yml +++ b/config/mongoid.yml @@ -1,11 +1,10 @@ development: host: localhost - database: <%= ENV['MONGODB_DATABASE_NAME'] %> - # database: badgify_development + database: badgify_development test: host: localhost - database: badgiy_test + database: badgify_test staging: uri: <%= ENV['MONGOLAB_URI'] %> diff --git a/vagrant/user-config.sh b/vagrant/user-config.sh index a32d5026..04c2ceb8 100755 --- a/vagrant/user-config.sh +++ b/vagrant/user-config.sh @@ -23,6 +23,10 @@ cd $HOME/web gem update --system && gem update bundler bundle config --global jobs 3 bundle install -bundle exec rake db:create:all -bundle exec rake db:setup -bundle exec rake db:test:prepare + +# Setup .env +cp .env.example .env -n + +foreman run rake db:create:all +foreman run rake db:setup +foreman run rake db:test:prepare