google_cloud_run 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/lib/google_cloud_run/util.rb +14 -0
- data/lib/google_cloud_run/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: 140059c654b57b4636c777d25c1f4fcb0ddde5a74f395e946004b3dfb7cd46b6
|
|
4
|
+
data.tar.gz: c6ebeab905a45f2b137d059dc3d41083dc3dc980ec4dd33f4e98d80d66df23ad
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 989b3182c2bf847c473769f690accee842d510298909e3392506c2d6a9de1146ec0478cecad3eb07637ffd619d67bc25b011d6ed259226a79fcea660908e1421
|
|
7
|
+
data.tar.gz: 4181d9a609f29fa6d2660c6f90a6fd22ccb0e144161ddc2584e703f92c0e253af0110528f0011f52bdb5c7dace2fe3e093930b5a3c0c85576dcd79f60fd5be15
|
data/README.md
CHANGED
|
@@ -69,6 +69,11 @@ queue_as "my-queue"
|
|
|
69
69
|
queue_as "us-central1/my-queue"
|
|
70
70
|
```
|
|
71
71
|
|
|
72
|
+
```ruby
|
|
73
|
+
# config/environments/production.rb
|
|
74
|
+
config.action_mailer.deliver_later_queue_name = "my-queue" # or "us-central1/my-queue"
|
|
75
|
+
```
|
|
76
|
+
|
|
72
77
|
---
|
|
73
78
|
|
|
74
79
|
In the default production config, the logger is wrapped around
|
|
@@ -56,6 +56,9 @@ module GoogleCloudRun
|
|
|
56
56
|
return "dummy-project" if Rails.env.test?
|
|
57
57
|
|
|
58
58
|
@project_id ||= begin
|
|
59
|
+
creds = parse_google_application_credentials
|
|
60
|
+
return creds["project_id"] unless creds["project_id"].blank?
|
|
61
|
+
|
|
59
62
|
uri = URI.parse("http://metadata.google.internal/computeMetadata/v1/project/project-id")
|
|
60
63
|
request = Net::HTTP::Get.new(uri)
|
|
61
64
|
request["Metadata-Flavor"] = "Google"
|
|
@@ -83,6 +86,9 @@ module GoogleCloudRun
|
|
|
83
86
|
return "123456789-compute@developer.gserviceaccount.com" if Rails.env.test?
|
|
84
87
|
|
|
85
88
|
@default_service_account_email ||= begin
|
|
89
|
+
creds = parse_google_application_credentials
|
|
90
|
+
return creds["email_client"] unless creds["client_email"].blank?
|
|
91
|
+
|
|
86
92
|
uri = URI.parse("http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/email")
|
|
87
93
|
request = Net::HTTP::Get.new(uri)
|
|
88
94
|
request["Metadata-Flavor"] = "Google"
|
|
@@ -102,4 +108,12 @@ module GoogleCloudRun
|
|
|
102
108
|
response.body.strip
|
|
103
109
|
end
|
|
104
110
|
end
|
|
111
|
+
|
|
112
|
+
def self.parse_google_application_credentials
|
|
113
|
+
file = ENV["GOOGLE_APPLICATION_CREDENTIALS"]
|
|
114
|
+
return {} if file.blank?
|
|
115
|
+
JSON.parse(File.read(file)).deep_stringify_keys
|
|
116
|
+
rescue
|
|
117
|
+
return {}
|
|
118
|
+
end
|
|
105
119
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google_cloud_run
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Matt Kadenbach
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-04-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rails
|