gce-host 0.3.0 → 0.3.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +6 -0
- data/README.md +3 -2
- data/example/example.conf +2 -1
- data/lib/gce/host/config.rb +5 -3
- data/lib/gce/host/version.rb +1 -1
- 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: 9dcb22f8502017ffafae992fec07a972eff348b8
|
4
|
+
data.tar.gz: 1167b8fa23f4d18d24cda1473799a60cf9964ead
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c3be2a15187ff646baa87b93377cbcfd86de9b9d7816ebc0f585d6b18bf0a87b4a54572a2aaf128fdca064313d84af8b410a9738809d50c403a09ebed5c0c01
|
7
|
+
data.tar.gz: af63c8a6aabbfa595de78f233814f9502047a269252f17c93b7e394c494ba441b2734bd671a0810b20a188afe5f91eefd1656deaab103e6110057f4203a23bb3
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -21,8 +21,9 @@ You can write a configuration file located at `/etc/sysconfig/gce-host` (You can
|
|
21
21
|
|
22
22
|
GOOGLE API parameters:
|
23
23
|
|
24
|
-
* **AUTH_METHOD (optional)**: Authentication method. Currently, `compute_engine`, `service_account`, `authorized_user`, and `application_default` is available. The default
|
24
|
+
* **AUTH_METHOD (optional)**: Authentication method. Currently, `compute_engine`, `service_account`, `authorized_user`, and `application_default` is available. The default is `application_default`
|
25
25
|
* **GOOGLE_APPLICATION_CREDENTIALS (optional)**: Specify path of json credential file. The default is `~/.config/gcloud/application_default_credentials.json`.
|
26
|
+
* **GOOGLE_PROJECT (optional)**: Specify project name of your GCP account. It tries to retrieve project_id if service account json is given in `GOOGLE_APPLICATION_CREDENTIALS`.
|
26
27
|
|
27
28
|
gce-host parameters:
|
28
29
|
|
@@ -169,7 +170,7 @@ NOTE: Currently, mock is not supported yet. So, you have to create your own gclo
|
|
169
170
|
Configure .env file as
|
170
171
|
|
171
172
|
```
|
172
|
-
AUTH_METHOD=
|
173
|
+
AUTH_METHOD=service_account
|
173
174
|
GOOGLE_APPLICATION_CREDENTIALS=service_acount.json
|
174
175
|
GOOGLE_PROJECT=XXXXXXXXXXXXX
|
175
176
|
OPTIONAL_STRING_KEYS=service,status
|
data/example/example.conf
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
AUTH_METHOD=
|
1
|
+
AUTH_METHOD=service_account
|
2
2
|
GOOGLE_APPLICATION_CREDENTIALS=~/.config/gcloud/your-project-000.json
|
3
3
|
ROLES_KEY=roles
|
4
4
|
ROLE_VALUE_DELIMITER=:
|
@@ -6,3 +6,4 @@ OPTIONAL_STRING_KEYS=service,status
|
|
6
6
|
OPTIONAL_ARRAY_KEYS=tags
|
7
7
|
ARRAY_VALUE_DELIMITER=,
|
8
8
|
LOG_LEVEL=info
|
9
|
+
STATUS=state
|
data/lib/gce/host/config.rb
CHANGED
@@ -16,12 +16,12 @@ class GCE
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.auth_method
|
19
|
-
@auth_method ||= ENV['AUTH_METHOD'] || config.fetch('AUTH_METHOD', nil) ||
|
19
|
+
@auth_method ||= ENV['AUTH_METHOD'] || config.fetch('AUTH_METHOD', nil) || 'application_default'
|
20
20
|
end
|
21
21
|
|
22
22
|
def self.credentials_file
|
23
23
|
# ref. https://developers.google.com/identity/protocols/application-default-credentials
|
24
|
-
@
|
24
|
+
@credentials_file ||= File.expand_path(ENV['GOOGLE_APPLICATION_CREDENTIALS'] || config.fetch('GOOGLE_APPLICATION_CREDENTIALS', nil) || credentials_file_default)
|
25
25
|
end
|
26
26
|
|
27
27
|
def self.credentials_file_default
|
@@ -57,7 +57,9 @@ class GCE
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def self.project
|
60
|
-
@project ||= ENV['GOOGLE_PROJECT'] || config.fetch('GOOGLE_PROJECT', nil) || credentials['project_id']
|
60
|
+
@project ||= ENV['GOOGLE_PROJECT'] || config.fetch('GOOGLE_PROJECT', nil) || credentials['project_id']
|
61
|
+
@project ||= credentials['client_email'].chomp('.iam.gserviceaccount.com').split('@').last if credentials['client_email']
|
62
|
+
@project ||= project_default
|
61
63
|
end
|
62
64
|
|
63
65
|
def self.log_level
|
data/lib/gce/host/version.rb
CHANGED