forest_liana 1.3.49 → 1.3.50
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/forest_liana/engine.rb +14 -9
- data/lib/forest_liana/version.rb +1 -1
- data/lib/forest_liana.rb +2 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0a6b543a48a355a813d8119dc78c50778e10f44
|
4
|
+
data.tar.gz: e4e75dad50f7e37e697f317a91f3455af3d0e6fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bb5b589f122f2edde3e6fd598268f0a5714d338cd6b514cbef6f0493dd682ad9495a0a6e0060aec8a7d2d5945bc8b061f4c0922340ab8a2ee9171657ff63326
|
7
|
+
data.tar.gz: f2c3e2103527b3650403dd9f00412a06bb005e99f081cc91ece8fb5b6a2e553d36e69863318f9825075d7e11b0860a0a331c955ac594821311ae768586b81b78
|
data/lib/forest_liana/engine.rb
CHANGED
@@ -12,22 +12,27 @@ module ForestLiana
|
|
12
12
|
class Engine < ::Rails::Engine
|
13
13
|
isolate_namespace ForestLiana
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
def configure_forest_cors
|
16
|
+
return unless ForestLiana.inject_forest_cors
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
hostnames = ['localhost:4200', 'app.forestadmin.com',
|
21
|
-
'www.forestadmin.com']
|
22
|
-
hostnames += ENV['CORS_ORIGINS'].split(',') if ENV['CORS_ORIGINS']
|
18
|
+
rack_cors_class = Rack::Cors
|
19
|
+
rack_cors_class = 'Rack::Cors' if Rails::VERSION::MAJOR < 5
|
23
20
|
|
24
|
-
|
25
|
-
|
21
|
+
config.middleware.insert_before 0, rack_cors_class do
|
22
|
+
allow do
|
23
|
+
hostnames = ['localhost:4200', 'app.forestadmin.com',
|
24
|
+
'www.forestadmin.com']
|
25
|
+
hostnames += ENV['CORS_ORIGINS'].split(',') if ENV['CORS_ORIGINS']
|
26
|
+
|
27
|
+
origins hostnames
|
28
|
+
resource '*', headers: :any, methods: :any
|
29
|
+
end
|
26
30
|
end
|
27
31
|
end
|
28
32
|
|
29
33
|
config.after_initialize do |app|
|
30
34
|
unless Rails.env.test?
|
35
|
+
configure_forest_cors
|
31
36
|
app.eager_load!
|
32
37
|
Bootstraper.new(app).perform
|
33
38
|
end
|
data/lib/forest_liana/version.rb
CHANGED
data/lib/forest_liana.rb
CHANGED
@@ -15,6 +15,7 @@ module ForestLiana
|
|
15
15
|
mattr_accessor :models
|
16
16
|
mattr_accessor :excluded_models
|
17
17
|
mattr_accessor :included_models
|
18
|
+
mattr_accessor :inject_forest_cors
|
18
19
|
|
19
20
|
# Legacy.
|
20
21
|
mattr_accessor :jwt_signing_key
|
@@ -24,4 +25,5 @@ module ForestLiana
|
|
24
25
|
self.models = []
|
25
26
|
self.excluded_models = []
|
26
27
|
self.included_models = []
|
28
|
+
self.inject_forest_cors = true
|
27
29
|
end
|