about summary refs log tree commit diff
path: root/config/initializers
diff options
context:
space:
mode:
authorStarfall <root@starfall.blue>2020-02-13 17:55:53 -0600
committerStarfall <root@starfall.blue>2020-02-13 17:55:53 -0600
commit5902299384d15249fe4b84b8761d4a49f3c7f6fd (patch)
tree66f1db08a2f6f9ae2254ba7a81b71835039d671e /config/initializers
parent6d24d3bcb84abd04f31da95f97f6d60ef0afdc00 (diff)
parent0cbd6d696b8937066cde297ad2eae4b558353b7c (diff)
Merge branch 'glitch'
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/0_duplicate_migrations.rb12
-rw-r--r--config/initializers/content_security_policy.rb2
2 files changed, 14 insertions, 0 deletions
diff --git a/config/initializers/0_duplicate_migrations.rb b/config/initializers/0_duplicate_migrations.rb
index 4ab806587..194aff70c 100644
--- a/config/initializers/0_duplicate_migrations.rb
+++ b/config/initializers/0_duplicate_migrations.rb
@@ -37,4 +37,16 @@ module ActiveRecord
       super(direction, migrations, target_version)
     end
   end
+
+  class MigrationContext
+    def needs_migration?
+      # A set of duplicated migrations is considered migrated if at least one of
+      # them is migrated.
+      migrated = get_all_versions
+      migrations.group_by(&:name).each do |name, duplicates|
+        return true unless duplicates.any? { |m| migrated.include?(m.version.to_i) }
+      end
+      return false
+    end
+  end
 end
diff --git a/config/initializers/content_security_policy.rb b/config/initializers/content_security_policy.rb
index c07af3ea8..221afab93 100644
--- a/config/initializers/content_security_policy.rb
+++ b/config/initializers/content_security_policy.rb
@@ -23,6 +23,8 @@ if Rails.env.production?
     data_hosts << "https://#{url.host}"
   end
 
+  data_hosts.concat(ENV['EXTRA_DATA_HOSTS'].split('|')) if ENV['EXTRA_DATA_HOSTS']
+
   data_hosts.uniq!
 
   Rails.application.config.content_security_policy do |p|