google-cloud-env 1.3.1 → 1.4.0
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/CHANGELOG.md +18 -0
- data/CONTRIBUTING.md +0 -13
- data/lib/google/cloud/env.rb +11 -3
- data/lib/google/cloud/env/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 98da1b266783f22f91d9f220cb311a35d3955d7f638e67aaa77d60e3ace6e58e
|
|
4
|
+
data.tar.gz: 39386abb55069149c081132808a85fc14a2b23285e3371b7632bbb1e7337815f
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 40ed7fab707ea30a4fa993d3c0560ef05ee9362c666191a5fe3f47a0edbac5e770fec6b5941be1c33d92b068e31fb1a094a3d34009b17b186ff60aaaf3707641
|
|
7
|
+
data.tar.gz: 7a4165816c410b2d8f0bf044b4d8c65f9bb4960dc8a976a97621ac7bcb424795b58863a2a8668b81a87b4081c82adf74e51e8c5705ef7f5c0094ced2de411028
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Release History
|
|
2
2
|
|
|
3
|
+
### 1.4.0 / 2020-10-12
|
|
4
|
+
|
|
5
|
+
#### Features
|
|
6
|
+
|
|
7
|
+
* Honor GCE_METADATA_HOST environment variable
|
|
8
|
+
|
|
9
|
+
### 1.3.3 / 2020-07-10
|
|
10
|
+
|
|
11
|
+
#### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* Project ID logic honors GOOGLE_CLOUD_PROJECT
|
|
14
|
+
|
|
15
|
+
### 1.3.2 / 2020-05-28
|
|
16
|
+
|
|
17
|
+
#### Documentation
|
|
18
|
+
|
|
19
|
+
* Fix a few broken links
|
|
20
|
+
|
|
3
21
|
### 1.3.1 / 2020-03-02
|
|
4
22
|
|
|
5
23
|
#### Bug Fixes
|
data/CONTRIBUTING.md
CHANGED
|
@@ -48,19 +48,6 @@ there is a small amount of setup:
|
|
|
48
48
|
$ bundle exec rake bundleupdate
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
## Console
|
|
52
|
-
|
|
53
|
-
In order to run code interactively, you can automatically load
|
|
54
|
-
google-cloud-env and its dependencies in IRB. This requires that your
|
|
55
|
-
developer environment has already been configured by following the steps
|
|
56
|
-
described in the {file:AUTHENTICATION.md Authentication Guide}. An IRB console
|
|
57
|
-
can be created with:
|
|
58
|
-
|
|
59
|
-
```sh
|
|
60
|
-
$ cd google-cloud-env/
|
|
61
|
-
$ bundle exec rake console
|
|
62
|
-
```
|
|
63
|
-
|
|
64
51
|
## hosting environment Tests
|
|
65
52
|
|
|
66
53
|
Tests are very important part of google-cloud-env. All contributions
|
data/lib/google/cloud/env.rb
CHANGED
|
@@ -82,6 +82,9 @@ module Google
|
|
|
82
82
|
# well as mocking for testing.
|
|
83
83
|
#
|
|
84
84
|
# @param [Hash] env Mock environment variables.
|
|
85
|
+
# @param [String] host The hostname or IP address of the metadata server.
|
|
86
|
+
# Optional. If not specified, uses the `GCE_METADATA_HOST`,
|
|
87
|
+
# environment variable or falls back to `169.254.167.254`.
|
|
85
88
|
# @param [Hash,false] metadata_cache The metadata cache. You may pass
|
|
86
89
|
# a prepopuated cache, an empty cache (the default) or `false` to
|
|
87
90
|
# disable the cache completely.
|
|
@@ -102,7 +105,7 @@ module Google
|
|
|
102
105
|
# If specified, overrides the `request_timeout` and `open_timeout`
|
|
103
106
|
# settings.
|
|
104
107
|
#
|
|
105
|
-
def initialize env: nil, connection: nil, metadata_cache: nil,
|
|
108
|
+
def initialize env: nil, host: nil, connection: nil, metadata_cache: nil,
|
|
106
109
|
open_timeout: 0.1, request_timeout: 1.0,
|
|
107
110
|
retry_count: 2, retry_interval: 0.1,
|
|
108
111
|
retry_backoff_factor: 1.5, retry_max_interval: 0.5
|
|
@@ -114,7 +117,9 @@ module Google
|
|
|
114
117
|
@retry_backoff_factor = retry_backoff_factor
|
|
115
118
|
@retry_max_interval = retry_max_interval
|
|
116
119
|
request_opts = { timeout: request_timeout, open_timeout: open_timeout }
|
|
117
|
-
|
|
120
|
+
host ||= @env["GCE_METADATA_HOST"] || METADATA_HOST
|
|
121
|
+
host = "http://#{host}" unless host.start_with? "http://"
|
|
122
|
+
@connection = connection || ::Faraday.new(url: host, request: request_opts)
|
|
118
123
|
end
|
|
119
124
|
|
|
120
125
|
##
|
|
@@ -210,7 +215,10 @@ module Google
|
|
|
210
215
|
# @return [String,nil]
|
|
211
216
|
#
|
|
212
217
|
def project_id
|
|
213
|
-
env["
|
|
218
|
+
env["GOOGLE_CLOUD_PROJECT"] ||
|
|
219
|
+
env["GCLOUD_PROJECT"] ||
|
|
220
|
+
env["DEVSHELL_PROJECT_ID"] ||
|
|
221
|
+
lookup_metadata("project", "project-id")
|
|
214
222
|
end
|
|
215
223
|
|
|
216
224
|
##
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google-cloud-env
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Daniel Azuma
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2020-
|
|
11
|
+
date: 2020-10-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -208,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
208
208
|
- !ruby/object:Gem::Version
|
|
209
209
|
version: '0'
|
|
210
210
|
requirements: []
|
|
211
|
-
rubygems_version: 3.
|
|
211
|
+
rubygems_version: 3.1.4
|
|
212
212
|
signing_key:
|
|
213
213
|
specification_version: 4
|
|
214
214
|
summary: Google Cloud Platform hosting environment information.
|