cloudrunpdf 0.1.0 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cloudrunpdf/builder.rb +6 -5
- data/lib/cloudrunpdf/configuration.rb +2 -3
- data/lib/cloudrunpdf/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: fd42ad0d28f30d92c080b40612bacd0f31fb1bc1148845c62cb425596c1fcb6e
|
4
|
+
data.tar.gz: f13744dd16439f8bdf96bc77b878f6b97972f7f26307a775419cb5ba7845cfb9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 948aa4bcc5e24b531dc2d4708411d1c2bf0a67fd51466b063e53e89ef88d11053d721e9d407ec0c72d451e127b382ddd6beb40fc8dad33c03a2db8578a6e77df
|
7
|
+
data.tar.gz: 8bef79deec940fb9b359c6b25be2d0ae8ea44e13aaecc9a399f77765bb6af244aa8f7e0db5ea0f253f11c4675b1bd257c2106353a4e862854b1d518b8cf1201b
|
data/lib/cloudrunpdf/builder.rb
CHANGED
@@ -5,14 +5,14 @@ require 'combine_pdf'
|
|
5
5
|
module Cloudrunpdf
|
6
6
|
class Builder
|
7
7
|
def initialize
|
8
|
-
@token = retrieve_authentication_token
|
9
8
|
@configuration = Cloudrunpdf.configuration
|
9
|
+
@token = retrieve_authentication_token
|
10
10
|
end
|
11
11
|
|
12
12
|
def print(data)
|
13
13
|
threads = []
|
14
14
|
|
15
|
-
data.
|
15
|
+
Array.wrap(data).each do |entry|
|
16
16
|
threads.append(
|
17
17
|
Thread.new { Thread.current[:pdf] = generate_pdf(entry) }
|
18
18
|
)
|
@@ -38,12 +38,13 @@ module Cloudrunpdf
|
|
38
38
|
private
|
39
39
|
|
40
40
|
def retrieve_authentication_token
|
41
|
-
if
|
41
|
+
if ENV['GCLOUD_AUTH_TOKEN'].present?
|
42
|
+
@token ||= ENV['GCLOUD_AUTH_TOKEN']
|
43
|
+
elsif Rails.env.in?(['development', 'test'])
|
42
44
|
@token ||= `gcloud auth print-identity-token`.strip
|
43
45
|
else
|
44
46
|
@token ||= Faraday.get(
|
45
|
-
@configuration.
|
46
|
-
"/identity?audience=#{PdfService::FUNCTION}&format=full",
|
47
|
+
"http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/identity?audience=#{@configuration.cloud_function_url}&format=full",
|
47
48
|
{},
|
48
49
|
{ metadata_flavor: 'Google' }
|
49
50
|
).body
|
@@ -3,11 +3,10 @@
|
|
3
3
|
module Cloudrunpdf
|
4
4
|
# Configuration options for gem
|
5
5
|
class Configuration
|
6
|
-
attr_accessor :cloud_function_url
|
6
|
+
attr_accessor :cloud_function_url
|
7
7
|
|
8
8
|
def initialize
|
9
|
-
@cloud_function_url = 'https://
|
10
|
-
@token_base_url = "http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default"
|
9
|
+
@cloud_function_url = 'https://htmlpdf-newer-7zhay37huq-ew.a.run.app'.freeze
|
11
10
|
end
|
12
11
|
end
|
13
12
|
end
|
data/lib/cloudrunpdf/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cloudrunpdf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bas Schoenmakers
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-06
|
12
|
+
date: 2022-09-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: combine_pdf
|