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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 379dc14ea6b12c76e8d18b87c82183709128af1d11979430e44af003d84c051f
4
- data.tar.gz: dd24b18dba69fb4a6f0b1a968d44ca7c26de5bc9184e1581abbd46eac8b4e1da
3
+ metadata.gz: 987cb4343dc95e07ffda2c04ecd4a1f752238bd31bfeeeb41fa440c150a99404
4
+ data.tar.gz: ba78b1131e83eb7d514a0086486ef7552b945133721a39663d7b2da15a1c11fb
5
5
  SHA512:
6
- metadata.gz: 24a4a36ea23bd60b8ab8d4f9c37a749320009fb9c2f29146eaad81fedb204ee3820e31d98b00733e0572a2f9b240545e064d97a8fbdb6d85946a2a0d01090195
7
- data.tar.gz: 18330df2a8b71b59c8f001c7802f6610b584a4af4caf5a767e4f1195d68c9766cda0b64ac599c19c5e54d6232fe7bc5380629fcdbbe45f29f3c6c7be001bbbf7
6
+ metadata.gz: 58c005f8881fc66f0cf63dc3843baf65784705356be282f09ab703b87b7fc7ec4bb8af77394b4661bbe91b4c915be4a6b14e91b039d6e0712e92226b7cfe1681
7
+ data.tar.gz: c144dc13bea071d56f76af8f824855f43ad8519c77442a1b8750050f7087f6357c1c5da4ed19eaa6b7ca3ddfb844df1f8db1d5d7042ac16bdae4adbf0b108b4d
data/cloudenv-hq.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'cloudenv-hq'
3
- s.version = '0.2.7'
3
+ s.version = '0.2.8'
4
4
  s.license = 'MIT'
5
5
  s.date = '2020-10-10'
6
6
  s.summary = 'Keep your ENV vars synced between your team members'
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'.freeze
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['CLOUDENV_BEARER_FILE'] || '~/.cloudenvrc')
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['CLOUDENV_APP_SECRET_KEY_FILE'] || '.cloudenv-secret-key')
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}" "https://app.cloudenv.com/api/v1/envs?name=#{@app}&environment=#{@environment}&version=#{VERSION}&lang=ruby" | openssl enc -a -aes-256-cbc -md sha512 -d -pass pass:"#{@secret_key}" 2> /dev/null`
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}" "https://app.cloudenv.com/api/v1/envs?name=#{@app}&environment=default&version=#{VERSION}&lang=ruby" | openssl enc -a -aes-256-cbc -md sha512 -d -pass pass:"#{@secret_key}" 2> /dev/null`
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudenv-hq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.7
4
+ version: 0.2.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lucas Carlson