cloudenv-hq 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/cloudenv-hq.gemspec +1 -1
- data/lib/cloudenv-hq.rb +10 -8
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 987cb4343dc95e07ffda2c04ecd4a1f752238bd31bfeeeb41fa440c150a99404
|
4
|
+
data.tar.gz: ba78b1131e83eb7d514a0086486ef7552b945133721a39663d7b2da15a1c11fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 58c005f8881fc66f0cf63dc3843baf65784705356be282f09ab703b87b7fc7ec4bb8af77394b4661bbe91b4c915be4a6b14e91b039d6e0712e92226b7cfe1681
|
7
|
+
data.tar.gz: c144dc13bea071d56f76af8f824855f43ad8519c77442a1b8750050f7087f6357c1c5da4ed19eaa6b7ca3ddfb844df1f8db1d5d7042ac16bdae4adbf0b108b4d
|
data/cloudenv-hq.gemspec
CHANGED
data/lib/cloudenv-hq.rb
CHANGED
@@ -4,7 +4,7 @@ require 'tempfile'
|
|
4
4
|
require 'yaml'
|
5
5
|
|
6
6
|
class CloudenvHQ
|
7
|
-
VERSION = '0.2.
|
7
|
+
VERSION = '0.2.8'.freeze
|
8
8
|
|
9
9
|
API_HOST = 'https://app.cloudenv.com'.freeze
|
10
10
|
READ_PATH = '/api/v1/envs'.freeze
|
@@ -15,7 +15,7 @@ class CloudenvHQ
|
|
15
15
|
if ENV['CLOUDENV_BEARER_TOKEN'] || options[:bearer]
|
16
16
|
@bearer = ENV['CLOUDENV_BEARER_TOKEN'] || options[:bearer]
|
17
17
|
else
|
18
|
-
@bearer_filename = File.expand_path(ENV['
|
18
|
+
@bearer_filename = File.expand_path(ENV['CLOUDENV_BEARER_PATH'] || '~/.cloudenvrc')
|
19
19
|
@bearer = IO.read(@bearer_filename).to_s.strip if File.exist?(@bearer_filename)
|
20
20
|
end
|
21
21
|
|
@@ -23,11 +23,11 @@ class CloudenvHQ
|
|
23
23
|
@app = ENV['CLOUDENV_APP_SLUG']
|
24
24
|
@secret_key = ENV['CLOUDENV_APP_SECRET_KEY']
|
25
25
|
else
|
26
|
-
@secret_key_filename = File.expand_path(ENV['
|
26
|
+
@secret_key_filename = File.expand_path(ENV['CLOUDENV_APP_SECRET_KEY_PATH'] || '.cloudenv-secret-key')
|
27
27
|
@secret_key = Pathname.new(@secret_key_filename)
|
28
28
|
|
29
29
|
until File.exist?(@secret_key) || @secret_key.expand_path == Pathname.new('/.cloudenv-secret-key')
|
30
|
-
@secret_key = @secret_key.parent.parent + @secret_key_filename
|
30
|
+
@secret_key = @secret_key.parent.parent + @secret_key_filename.split('/').last
|
31
31
|
end
|
32
32
|
|
33
33
|
if File.exist?(@secret_key)
|
@@ -40,20 +40,22 @@ class CloudenvHQ
|
|
40
40
|
|
41
41
|
if @bearer && @app && @secret_key
|
42
42
|
if @environment
|
43
|
-
data = `curl -s -H "Authorization: Bearer #{@bearer}" "
|
43
|
+
data = `curl -s -H "Authorization: Bearer #{@bearer}" "#{API_HOST}#{READ_PATH}?name=#{@app}&environment=#{@environment}&version=#{VERSION}&lang=ruby" | openssl enc -a -aes-256-cbc -md sha512 -d -pass pass:"#{@secret_key}" 2> /dev/null`
|
44
44
|
file = Tempfile.new('cloudenv')
|
45
|
-
file.write(data)
|
45
|
+
file.write(data.encode('UTF-8', invalid: :replace, replace: ''))
|
46
46
|
file.close
|
47
47
|
Dotenv.load(file.path)
|
48
48
|
file.unlink
|
49
49
|
end
|
50
50
|
|
51
|
-
data = `curl -s -H "Authorization: Bearer #{@bearer}" "
|
51
|
+
data = `curl -s -H "Authorization: Bearer #{@bearer}" "#{API_HOST}#{READ_PATH}?name=#{@app}&environment=default&version=#{VERSION}&lang=ruby" | openssl enc -a -aes-256-cbc -md sha512 -d -pass pass:"#{@secret_key}" 2> /dev/null`
|
52
52
|
file = Tempfile.new('cloudenv')
|
53
|
-
file.write(data)
|
53
|
+
file.write(data.encode('UTF-8', invalid: :replace, replace: ''))
|
54
54
|
file.close
|
55
|
+
puts 1
|
55
56
|
Dotenv.load(file.path)
|
56
57
|
file.unlink
|
58
|
+
|
57
59
|
else
|
58
60
|
warn 'WARNING: cloudenv could not find a .cloudenv-secret-key in the directory path or values for both ENV["CLOUDENV_APP_SLUG"] and ENV["CLOUDENV_APP_SECRET_KEY"]'
|
59
61
|
end
|