mirror of
https://github.com/mastodon/mastodon.git
synced 2025-07-14 16:28:16 +00:00
Compare commits
2 Commits
35e15bf100
...
729bb2091f
Author | SHA1 | Date | |
---|---|---|---|
![]() |
729bb2091f | ||
![]() |
0b71d2aef9 |
|
@ -108,6 +108,7 @@ module Mastodon
|
|||
config.x.email = config_for(:email)
|
||||
config.x.mastodon = config_for(:mastodon)
|
||||
config.x.omniauth = config_for(:omniauth)
|
||||
config.x.search = config_for(:search)
|
||||
config.x.translation = config_for(:translation)
|
||||
config.x.vapid = config_for(:vapid)
|
||||
|
||||
|
|
|
@ -1,26 +1,16 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
enabled = ENV['ES_ENABLED'] == 'true'
|
||||
host = ENV.fetch('ES_HOST') { 'localhost' }
|
||||
port = ENV.fetch('ES_PORT') { 9200 }
|
||||
user = ENV.fetch('ES_USER', nil).presence
|
||||
password = ENV.fetch('ES_PASS', nil).presence
|
||||
prefix = ENV.fetch('ES_PREFIX', nil)
|
||||
ca_file = ENV.fetch('ES_CA_FILE', nil).presence
|
||||
|
||||
transport_options = { ssl: { ca_file: ca_file } } if ca_file.present?
|
||||
|
||||
Chewy.settings = {
|
||||
host: "#{host}:#{port}",
|
||||
prefix: prefix,
|
||||
enabled: enabled,
|
||||
host: "#{Rails.configuration.x.search.host}:#{Rails.configuration.x.search.port}",
|
||||
prefix: Rails.configuration.x.search.prefix,
|
||||
enabled: Rails.configuration.x.search.enabled,
|
||||
journal: false,
|
||||
user: user,
|
||||
password: password,
|
||||
user: Rails.configuration.x.search.user,
|
||||
password: Rails.configuration.x.search.password,
|
||||
index: {
|
||||
number_of_replicas: ['single_node_cluster', nil].include?(ENV['ES_PRESET'].presence) ? 0 : 1,
|
||||
number_of_replicas: ['single_node_cluster', nil].include?(Rails.configuration.x.search.preset) ? 0 : 1,
|
||||
},
|
||||
transport_options: transport_options,
|
||||
transport_options: { ssl: { ca_file: Rails.configuration.x.search.ca_file }.compact.presence }.compact.presence,
|
||||
}
|
||||
|
||||
# We use our own async strategy even outside the request-response
|
||||
|
|
9
config/search.yml
Normal file
9
config/search.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
shared:
|
||||
ca_file: <%= ENV.fetch('ES_CA_FILE', nil).presence %>
|
||||
enabled: <%= ENV.fetch('ES_ENABLED', nil) == 'true' %>
|
||||
host: <%= ENV.fetch('ES_HOST') { 'localhost' } %>
|
||||
password: <%= ENV.fetch('ES_PASS', nil).presence %>
|
||||
port: <%= ENV.fetch('ES_PORT') { 9200 } %>
|
||||
prefix: <%= ENV.fetch('ES_PREFIX', nil) %>
|
||||
preset: <%= ENV.fetch('ES_PRESET', nil).presence %>
|
||||
user: <%= ENV.fetch('ES_USER', nil).presence %>
|
|
@ -3,7 +3,7 @@
|
|||
module Chewy
|
||||
module IndexExtensions
|
||||
def index_preset(base_options = {})
|
||||
case ENV['ES_PRESET'].presence
|
||||
case Rails.configuration.x.search.preset
|
||||
when 'single_node_cluster', nil
|
||||
base_options.merge(number_of_replicas: 0)
|
||||
when 'small_cluster'
|
||||
|
|
Loading…
Reference in New Issue
Block a user