Skip to content

Commit

Permalink
rework DB configuration to work with GH actions
Browse files Browse the repository at this point in the history
  • Loading branch information
urkle committed Dec 9, 2021
1 parent efa3ffc commit 28a8a80
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/schema_dev/rspec/db.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def configuration
{
"adapter" => 'mysql',
"database" => database,
"hostname" => hostname,
"username" => ENV.fetch('MYSQL_DB_USER', 'schema_plus'),
"encoding" => 'utf8',
"min_messages" => 'warning'
Expand All @@ -49,15 +50,17 @@ def configuration
{
"adapter" => 'mysql2',
"database" => database,
"hostname" => hostname,
"username" => ENV.fetch('MYSQL_DB_USER', 'schema_plus'),
"encoding" => 'utf8',
"min_messages" => 'warning'
}
when 'postgresql'
{
"adapter" => 'postgresql',
"username" => ENV['POSTGRESQL_DB_USER'],
"database" => database,
"hostname" => hostname,
"username" => ENV['POSTGRESQL_DB_USER'],
"min_messages" => 'warning'
}
when 'sqlite3'
Expand All @@ -67,7 +70,7 @@ def configuration
}
else
raise "Unknown db adapter #{@db.inspect}"
end
end.compat
end

def connect
Expand All @@ -85,6 +88,10 @@ def set_logger
ActiveRecord::Base.logger = Logger.new(logroot.join("#{ruby}-#{activerecord}-#{@db}.log").open("w"))
end

def hostname
ENV['DB_HOSTNAME']
end

module Helpers
extend self

Expand Down

0 comments on commit 28a8a80

Please sign in to comment.