dotenv: enable overriding database settings.
This commit is contained in:
@@ -6,7 +6,7 @@ class PoolArchive < ActiveRecord::Base
|
|||||||
Danbooru.config.aws_sqs_archives_url.present?
|
Danbooru.config.aws_sqs_archives_url.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
establish_connection "archive_#{Rails.env}".to_sym if enabled?
|
establish_connection (ENV["ARCHIVE_DATABASE_URL"] || "archive_#{Rails.env}".to_sym) if enabled?
|
||||||
self.table_name = "pool_versions"
|
self.table_name = "pool_versions"
|
||||||
|
|
||||||
module SearchMethods
|
module SearchMethods
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ class PostArchive < ActiveRecord::Base
|
|||||||
Danbooru.config.aws_sqs_archives_url.present?
|
Danbooru.config.aws_sqs_archives_url.present?
|
||||||
end
|
end
|
||||||
|
|
||||||
establish_connection "archive_#{Rails.env}".to_sym if enabled?
|
establish_connection (ENV["ARCHIVE_DATABASE_URL"] || "archive_#{Rails.env}".to_sym) if enabled?
|
||||||
self.table_name = "post_versions"
|
self.table_name = "post_versions"
|
||||||
|
|
||||||
def self.calculate_version(post_id, updated_at, version_id)
|
def self.calculate_version(post_id, updated_at, version_id)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class PostReadOnly < Post
|
class PostReadOnly < Post
|
||||||
establish_connection "ro_#{Rails.env}".to_sym
|
establish_connection (ENV["RO_DATABASE_URL"] || "ro_#{Rails.env}".to_sym)
|
||||||
attr_readonly *column_names
|
attr_readonly *column_names
|
||||||
|
|
||||||
def with_timeout(n, default_value = nil)
|
def with_timeout(n, default_value = nil)
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ development:
|
|||||||
database: danbooru2
|
database: danbooru2
|
||||||
pool: 5
|
pool: 5
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
|
url: <%= ENV['DATABASE_URL'] %>
|
||||||
|
|
||||||
# Warning: The database defined as "test" will be erased and
|
# Warning: The database defined as "test" will be erased and
|
||||||
# re-generated from your development database when you run "rake".
|
# re-generated from your development database when you run "rake".
|
||||||
@@ -14,42 +15,52 @@ test:
|
|||||||
database: danbooru2_test
|
database: danbooru2_test
|
||||||
pool: 5
|
pool: 5
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
|
url: <%= ENV['DATABASE_URL'] %>
|
||||||
|
|
||||||
production:
|
production:
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: danbooru2
|
database: danbooru2
|
||||||
pool: 5
|
pool: 5
|
||||||
timeout: 5000
|
timeout: 5000
|
||||||
|
url: <%= ENV['DATABASE_URL'] %>
|
||||||
|
|
||||||
# read only databases, just point to local copies if you have no need
|
# read only databases, just point to local copies if you have no need
|
||||||
ro_development:
|
ro_development:
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: danbooru2
|
database: danbooru2
|
||||||
|
url: <%= ENV['RO_DATABASE_URL'] %>
|
||||||
|
|
||||||
ro_test:
|
ro_test:
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: danbooru2_test
|
database: danbooru2_test
|
||||||
|
url: <%= ENV['RO_DATABASE_URL'] %>
|
||||||
|
|
||||||
ro_production:
|
ro_production:
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: danbooru2
|
database: danbooru2
|
||||||
|
url: <%= ENV['RO_DATABASE_URL'] %>
|
||||||
|
|
||||||
ro_staging:
|
ro_staging:
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: danbooru2
|
database: danbooru2
|
||||||
|
url: <%= ENV['RO_DATABASE_URL'] %>
|
||||||
|
|
||||||
archive_development:
|
archive_development:
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: archive_development
|
database: archive_development
|
||||||
|
url: <%= ENV['ARCHIVE_DATABASE_URL'] %>
|
||||||
|
|
||||||
archive_test:
|
archive_test:
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: archive_test
|
database: archive_test
|
||||||
|
url: <%= ENV['ARCHIVE_DATABASE_URL'] %>
|
||||||
|
|
||||||
archive_production:
|
archive_production:
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: archive_development
|
database: archive_development
|
||||||
|
url: <%= ENV['ARCHIVE_DATABASE_URL'] %>
|
||||||
|
|
||||||
archive_staging:
|
archive_staging:
|
||||||
adapter: postgresql
|
adapter: postgresql
|
||||||
database: archive_development
|
database: archive_development
|
||||||
|
url: <%= ENV['ARCHIVE_DATABASE_URL'] %>
|
||||||
|
|||||||
Reference in New Issue
Block a user