zuora_connect 3.1.2 → 3.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/zuora_connect/static_controller.rb +44 -6
- data/config/initializers/redis.rb +19 -0
- data/config/routes.rb +1 -0
- data/lib/tasks/zuora_connect_tasks.rake +12 -9
- data/lib/zuora_connect/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ce9871a6d530d5d0146cf591445fd21ec4f1cba986944b8b966ddc493c5f1a1
|
4
|
+
data.tar.gz: db1756a9a29035a6180ce3370021432a6b255567b8aeaea1eb36ad3f25651ff6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aea09cd52f629f8feb5a57a2e200040ad0371a64086c15a662f3408f77ef930211dceb2b01ebbfecc7ca437f268b262a60f52f05d43a3b0ca17e830db72a7e63
|
7
|
+
data.tar.gz: b324ac9bd0f233b04e641efafc2e62e4344218c84f99005fbe67a31a301ececb56411966b67b7a7333ee6581500ee72af4780aea6fa7c58dc15abd60c29c8169
|
@@ -1,12 +1,11 @@
|
|
1
1
|
module ZuoraConnect
|
2
2
|
class StaticController < ApplicationController
|
3
|
-
before_action :authenticate_connect_app_request, :except => [:health, :initialize_app, :provision, :instance_user]
|
4
|
-
before_action :clear_connect_app_session, :only => [:health, :initialize_app, :provision, :instance_user]
|
5
|
-
after_action :persist_connect_app_session, :except => [:health, :initialize_app, :provision, :instance_user]
|
6
|
-
|
7
|
-
skip_before_action :verify_authenticity_token, :only => [:initialize_app, :provision]
|
8
|
-
http_basic_authenticate_with name: ENV['PROVISION_USER'], password: ENV['PROVISION_SECRET'], :only => [:provision, :instance_user]
|
3
|
+
before_action :authenticate_connect_app_request, :except => [:health, :initialize_app, :provision, :instance_user, :instance_drop]
|
4
|
+
before_action :clear_connect_app_session, :only => [:health, :initialize_app, :provision, :instance_user, :instance_drop]
|
5
|
+
after_action :persist_connect_app_session, :except => [:health, :initialize_app, :provision, :instance_user, :instance_drop]
|
9
6
|
|
7
|
+
skip_before_action :verify_authenticity_token, :only => [:initialize_app, :provision, :instance_drop]
|
8
|
+
http_basic_authenticate_with name: ENV['PROVISION_USER'], password: ENV['PROVISION_SECRET'], :only => [:provision, :instance_user, :instance_drop]
|
10
9
|
|
11
10
|
def health
|
12
11
|
if params[:error].present?
|
@@ -119,6 +118,45 @@ module ZuoraConnect
|
|
119
118
|
}, status: 500
|
120
119
|
end
|
121
120
|
|
121
|
+
def instance_drop
|
122
|
+
host = request.headers.fetch("HOST", nil)
|
123
|
+
if host.present? && ZuoraConnect::AppInstance::INTERNAL_HOSTS.include?(host)
|
124
|
+
ZuoraConnect::AppInstance.read_master_db do
|
125
|
+
instance_id = params[:id]
|
126
|
+
@appinstance = ZuoraConnect::AppInstance.find(instance_id)
|
127
|
+
if @appinstance.drop_instance
|
128
|
+
ZuoraConnect::AppInstance.destroy(instance_id)
|
129
|
+
msg = Apartment::Tenant.drop(instance_id)
|
130
|
+
|
131
|
+
if msg.error_message.present?
|
132
|
+
render json: { "message" => msg.error_message }, status: :bad_request
|
133
|
+
else
|
134
|
+
render json: {
|
135
|
+
status: 200,
|
136
|
+
message: 'Success',
|
137
|
+
app_instance_id: instance_id
|
138
|
+
}, status: 200
|
139
|
+
end
|
140
|
+
else
|
141
|
+
render json: { "message" => @appinstance.drop_message }, status: :bad_request
|
142
|
+
end
|
143
|
+
end
|
144
|
+
else
|
145
|
+
render json: { "message" => "Host #{host} is not internal" }, status: :bad_request
|
146
|
+
end
|
147
|
+
rescue StandardError => e
|
148
|
+
message = 'Failed to drop instance'
|
149
|
+
if performed?
|
150
|
+
Rails.logger.error("#{message}: #{performed?}", e)
|
151
|
+
else
|
152
|
+
Rails.logger.error(message, e)
|
153
|
+
render json: {
|
154
|
+
status: 500,
|
155
|
+
message: message
|
156
|
+
}, status: 500
|
157
|
+
end
|
158
|
+
end
|
159
|
+
|
122
160
|
private
|
123
161
|
|
124
162
|
def clear_connect_app_session
|
@@ -18,10 +18,29 @@ class Redis
|
|
18
18
|
def self.current=(redis)
|
19
19
|
@current = redis
|
20
20
|
end
|
21
|
+
|
22
|
+
def self.subscriber
|
23
|
+
@subscriber ||= Redis.new
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.subscriber=(redis)
|
27
|
+
@subscriber = redis
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.publisher
|
31
|
+
@publisher ||= Redis.new
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.publisher=(redis)
|
35
|
+
@publisher = redis
|
36
|
+
end
|
21
37
|
end
|
22
38
|
|
23
39
|
if defined?(Redis.current)
|
24
40
|
Redis.current = Redis.new(:id => "#{ZuoraObservability::Env.full_process_name(process_name: 'Redis')}", :url => redis_url, :timeout => 6, :reconnect_attempts => 2)
|
41
|
+
Redis.subscriber = Redis.new(:id => "#{ZuoraObservability::Env.full_process_name(process_name: 'RedisSubscriber')}", :url => redis_url, :timeout => 6, :reconnect_attempts => 2)
|
42
|
+
Redis.publisher = Redis.new(:id => "#{ZuoraObservability::Env.full_process_name(process_name: 'RedisPublisher')}", :url => redis_url, :timeout => 6, :reconnect_attempts => 2)
|
43
|
+
|
25
44
|
browser_urls['Redis'] = { "url" => redis_url }
|
26
45
|
if defined?(Resque.redis)
|
27
46
|
if resque_url != redis_url
|
data/config/routes.rb
CHANGED
@@ -2,15 +2,18 @@ namespace :db do
|
|
2
2
|
desc 'Also create shared_extensions Schema'
|
3
3
|
task :extensions => :environment do
|
4
4
|
# Create Schema
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp" SCHEMA shared_extensions;'
|
11
|
-
}
|
5
|
+
ActiveRecord::Base.connection.execute 'CREATE SCHEMA IF NOT EXISTS shared_extensions;'
|
6
|
+
# Enable Hstore
|
7
|
+
ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS HSTORE SCHEMA shared_extensions;'
|
8
|
+
# Enable UUID-OSSP
|
9
|
+
ActiveRecord::Base.connection.execute 'CREATE EXTENSION IF NOT EXISTS "uuid-ossp" SCHEMA shared_extensions;'
|
12
10
|
end
|
13
11
|
end
|
14
12
|
|
15
|
-
Rake::Task["db:create"].enhance
|
16
|
-
Rake::Task["db:
|
13
|
+
Rake::Task["db:create"].enhance do
|
14
|
+
Rake::Task["db:extensions"].invoke
|
15
|
+
end
|
16
|
+
|
17
|
+
Rake::Task["db:test:purge"].enhance do
|
18
|
+
Rake::Task["db:extensions"].invoke
|
19
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|