Skip to content

Commit

Permalink
use APP_ENV instead of RAILS_ENV (#106)
Browse files Browse the repository at this point in the history
  • Loading branch information
bedrock-adam authored Aug 12, 2024
1 parent ae0f73c commit ef2ad35
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 19 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ jobs:
export PGPASSWORD=outboxer_password
psql -h localhost -U outboxer_developer -d outboxer_test -c 'SELECT version();'
- name: run database migrations
run: RAILS_ENV=test bin/rake outboxer:db:migrate
run: APP_ENV=test bin/rake outboxer:db:migrate
- name: run rspec
run: RAILS_ENV=test bin/rspec spec
run: APP_ENV=test bin/rspec spec

mysql:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -96,15 +96,15 @@ jobs:
mysql -h 127.0.0.1 -P 3306 -u outboxer_developer -poutboxer_password outboxer_test -e 'SELECT VERSION();'
- name: run database migrations
env:
RAILS_ENV: test
APP_ENV: test
DATABASE_ADAPTER: mysql2
DATABASE_HOST: 127.0.0.1
DATABASE_PORT: 3306
run: |
bin/rake outboxer:db:migrate
- name: run rspec
env:
RAILS_ENV: test
APP_ENV: test
DATABASE_ADAPTER: mysql2
DATABASE_PORT: 3306
DATABASE_HOST: 127.0.0.1
Expand Down
2 changes: 1 addition & 1 deletion bin/console
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ require 'bundler/setup'
require 'outboxer'
require 'sidekiq'

environment = ENV['RAILS_ENV'] || 'development'
environment = ENV['APP_ENV'] || 'development'
config = Outboxer::Database.config(environment: environment, pool: 1)
Outboxer::Database.connect(config: config)

Expand Down
2 changes: 1 addition & 1 deletion bin/outboxer_published_messages_deleter
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ interval = options[:interval] || 1
retention_period = options[:retention_period] || 10
batch_size = options[:batch_size] || 100

environment = ENV['RAILS_ENV'] || 'development'
environment = ENV['APP_ENV'] || 'development'

logger = Outboxer::Logger.new($stdout, level: log_level)

Expand Down
2 changes: 1 addition & 1 deletion bin/outboxer_publisher
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ OptionParser.new do |opts|
end
end.parse!

environment = ENV['RAILS_ENV'] || 'development'
environment = ENV['APP_ENV'] || 'development'

require_relative '../app/jobs/event_created_job'

Expand Down
2 changes: 1 addition & 1 deletion bin/outboxer_publishermon
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def outboxer_publisher_pids
`pgrep -f bin/outboxer_publisher$`.strip.split("\n")
end

environment = ENV['RAILS_ENV'] || 'development'
environment = ENV['APP_ENV'] || 'development'
config = Outboxer::Database.config(environment: environment)
Outboxer::Database.connect(config: config.merge('pool' => 1))

Expand Down
2 changes: 1 addition & 1 deletion config/sidekiq.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

require_relative '../app/jobs/event_created_job'

environment = ENV['RAILS_ENV'] || 'development'
environment = ENV['APP_ENV'] || 'development'

db_config_content = File.read('config/database.yml')
db_config_erb_result = ERB.new(db_config_content).result
Expand Down
2 changes: 1 addition & 1 deletion lib/outboxer/web.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

require 'pry-byebug'

environment = ENV['RAILS_ENV'] || 'development'
environment = ENV['APP_ENV'] || 'development'
config = Outboxer::Database.config(environment: environment, pool: 1)
Outboxer::Database.connect(config: config)

Expand Down
18 changes: 9 additions & 9 deletions tasks/database.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ require 'pry-byebug'
namespace :outboxer do
namespace :db do
task :drop do
environment = ENV['RAILS_ENV'] || 'development'
environment = ENV['APP_ENV'] || 'development'
db_config = Outboxer::Database.config(environment: environment, pool: 1)

ActiveRecord::Base.establish_connection(db_config.merge('database' => 'postgres'))
Expand All @@ -15,7 +15,7 @@ namespace :outboxer do
end

task :create do
environment = ENV['RAILS_ENV'] || 'development'
environment = ENV['APP_ENV'] || 'development'
db_config = Outboxer::Database.config(environment: environment, pool: 1)

ActiveRecord::Base.establish_connection(db_config.merge('database' => 'postgres'))
Expand All @@ -24,7 +24,7 @@ namespace :outboxer do
end

task :migrate do
environment = ENV['RAILS_ENV'] || 'development'
environment = ENV['APP_ENV'] || 'development'
db_config = Outboxer::Database.config(environment: environment, pool: 1)
ActiveRecord::Base.establish_connection(db_config)

Expand All @@ -44,7 +44,7 @@ namespace :outboxer do
end

task :seed do
environment = ENV['RAILS_ENV'] || 'development'
environment = ENV['APP_ENV'] || 'development'
db_config = Outboxer::Database.config(environment: environment, pool: 1)
ActiveRecord::Base.establish_connection(db_config)

Expand All @@ -59,8 +59,8 @@ namespace :outboxer do
end
end

# RAILS_ENV=development bin/rake outboxer:db:drop
# RAILS_ENV=development bin/rake outboxer:db:create
# RAILS_ENV=development bin/rake outboxer:db:migrate
# RAILS_ENV=development bin/rake outboxer:db:seed
# RAILS_ENV=development bin/rake outboxer:db:reset
# APP_ENV=development bin/rake outboxer:db:drop
# APP_ENV=development bin/rake outboxer:db:create
# APP_ENV=development bin/rake outboxer:db:migrate
# APP_ENV=development bin/rake outboxer:db:seed
# APP_ENV=development bin/rake outboxer:db:reset

0 comments on commit ef2ad35

Please sign in to comment.