about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-10-05 15:23:57 +0200
committerThibaut Girka <thib@sitedethib.com>2018-10-05 15:23:57 +0200
commit00fcdebed758f031b486ec239fd425fc54a180b3 (patch)
tree1211e136ba3e886ee8daaa5200babffc42375dd1 /config/initializers
parenta9e8f98a9d32c57956d41009bd09a1f33310676e (diff)
parent028ad4124cf1fdb28f5cf11bd7080e7a63f2f99e (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Conflicts:
	db/migrate/20170716191202_add_hide_notifications_to_mute.rb
	spec/controllers/application_controller_spec.rb

Took our version, upstream changes were only minor style linting.
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/1_hosts.rb2
-rw-r--r--config/initializers/http_client_proxy.rb2
-rw-r--r--config/initializers/omniauth.rb5
-rw-r--r--config/initializers/open_uri_redirection.rb2
-rw-r--r--config/initializers/rack_attack.rb2
-rw-r--r--config/initializers/sidekiq.rb2
-rw-r--r--config/initializers/twitter_regex.rb1
-rw-r--r--config/initializers/vapid.rb1
8 files changed, 7 insertions, 10 deletions
diff --git a/config/initializers/1_hosts.rb b/config/initializers/1_hosts.rb
index 5773b7290..757f1f735 100644
--- a/config/initializers/1_hosts.rb
+++ b/config/initializers/1_hosts.rb
@@ -7,7 +7,7 @@ web_host = ENV.fetch('WEB_DOMAIN') { host }
 alternate_domains = ENV.fetch('ALTERNATE_DOMAINS') { '' }
 
 Rails.application.configure do
-  https    = Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true'
+  https = Rails.env.production? || ENV['LOCAL_HTTPS'] == 'true'
 
   config.x.local_domain = host
   config.x.web_domain   = web_host
diff --git a/config/initializers/http_client_proxy.rb b/config/initializers/http_client_proxy.rb
index e607aff3c..9d7b16e69 100644
--- a/config/initializers/http_client_proxy.rb
+++ b/config/initializers/http_client_proxy.rb
@@ -6,7 +6,7 @@ Rails.application.configure do
     raise "No proxy host" unless proxy.host
 
     host = proxy.host
-    host = host[1...-1] if host[0] == '[' #for IPv6 address
+    host = host[1...-1] if host[0] == '[' # for IPv6 address
     config.x.http_client_proxy[:proxy] = { proxy_address: host, proxy_port: proxy.port, proxy_username: proxy.user, proxy_password: proxy.password }.compact
   end
 
diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb
index 85fb81250..254e751d4 100644
--- a/config/initializers/omniauth.rb
+++ b/config/initializers/omniauth.rb
@@ -3,7 +3,7 @@ Rails.application.config.middleware.use OmniAuth::Builder do
 end
 
 Devise.setup do |config|
-  # Devise omniauth strategies
+  # Devise omniauth strategies
   options = {}
   options[:redirect_at_sign_in] = ENV['OAUTH_REDIRECT_AT_SIGN_IN'] == 'true'
 
@@ -38,7 +38,7 @@ Devise.setup do |config|
     saml_options = options
     saml_options[:assertion_consumer_service_url] = ENV['SAML_ACS_URL'] if ENV['SAML_ACS_URL']
     saml_options[:issuer] = ENV['SAML_ISSUER'] if ENV['SAML_ISSUER']
-    saml_options[:idp_sso_target_url] = ENV['SAML_IDP_SSO_TARGET_URL']  if ENV['SAML_IDP_SSO_TARGET_URL']
+    saml_options[:idp_sso_target_url] = ENV['SAML_IDP_SSO_TARGET_URL'] if ENV['SAML_IDP_SSO_TARGET_URL']
     saml_options[:idp_sso_target_url_runtime_params] = ENV['SAML_IDP_SSO_TARGET_PARAMS'] if ENV['SAML_IDP_SSO_TARGET_PARAMS'] # FIXME: Should be parsable Hash
     saml_options[:idp_cert] = ENV['SAML_IDP_CERT'] if ENV['SAML_IDP_CERT']
     saml_options[:idp_cert_fingerprint] = ENV['SAML_IDP_CERT_FINGERPRINT'] if ENV['SAML_IDP_CERT_FINGERPRINT']
@@ -62,5 +62,4 @@ Devise.setup do |config|
     saml_options[:uid_attribute] = ENV['SAML_UID_ATTRIBUTE'] if ENV['SAML_UID_ATTRIBUTE']
     config.omniauth :saml, saml_options
   end
-
 end
diff --git a/config/initializers/open_uri_redirection.rb b/config/initializers/open_uri_redirection.rb
index e24fdecab..ea2dcffea 100644
--- a/config/initializers/open_uri_redirection.rb
+++ b/config/initializers/open_uri_redirection.rb
@@ -1,7 +1,7 @@
 require 'open-uri'
 
 module OpenURI
-  def OpenURI.redirectable?(uri1, uri2) # :nodoc:
+  def self.redirectable?(uri1, uri2) # :nodoc:
     uri1.scheme.downcase == uri2.scheme.downcase ||
       (/\A(?:http|https|ftp)\z/i =~ uri1.scheme && /\A(?:http|https|ftp)\z/i =~ uri2.scheme)
   end
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb
index 0ca0a7e7f..8756b8fbf 100644
--- a/config/initializers/rack_attack.rb
+++ b/config/initializers/rack_attack.rb
@@ -42,7 +42,7 @@ class Rack::Attack
   # (blocklist & throttles are skipped)
   Rack::Attack.safelist('allow from localhost') do |req|
     # Requests are allowed if the return value is truthy
-    '127.0.0.1' == req.ip || '::1' == req.ip
+    req.ip == '127.0.0.1' || req.ip == '::1'
   end
 
   throttle('throttle_authenticated_api', limit: 300, period: 5.minutes) do |req|
diff --git a/config/initializers/sidekiq.rb b/config/initializers/sidekiq.rb
index 05c804100..7f8a40d7b 100644
--- a/config/initializers/sidekiq.rb
+++ b/config/initializers/sidekiq.rb
@@ -19,4 +19,4 @@ Sidekiq.configure_client do |config|
   config.redis = redis_params
 end
 
-Sidekiq::Logging.logger.level = ::Logger::const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s)
+Sidekiq::Logging.logger.level = ::Logger.const_get(ENV.fetch('RAILS_LOG_LEVEL', 'info').upcase.to_s)
diff --git a/config/initializers/twitter_regex.rb b/config/initializers/twitter_regex.rb
index 76b23f416..0e8f5bfeb 100644
--- a/config/initializers/twitter_regex.rb
+++ b/config/initializers/twitter_regex.rb
@@ -1,6 +1,5 @@
 module Twitter
   class Regex
-
     REGEXEN[:valid_general_url_path_chars] = /[^\p{White_Space}\(\)\?]/iou
     REGEXEN[:valid_url_path_ending_chars] = /[^\p{White_Space}\(\)\?!\*';:=\,\.\$%\[\]~&\|@]|(?:#{REGEXEN[:valid_url_balanced_parens]})/iou
     REGEXEN[:valid_url_balanced_parens] = /
diff --git a/config/initializers/vapid.rb b/config/initializers/vapid.rb
index 618f5a3fb..7dd870c8b 100644
--- a/config/initializers/vapid.rb
+++ b/config/initializers/vapid.rb
@@ -1,7 +1,6 @@
 # frozen_string_literal: true
 
 Rails.application.configure do
-
   # You can generate the keys using the following command (first is the private key, second is the public one)
   # You should only generate this once per instance. If you later decide to change it, all push subscription will
   # be invalidated, requiring the users to access the website again to resubscribe.