dex_sync 0.1.0 → 0.1.1

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
  SHA1:
3
- metadata.gz: 611dfffec648e23582f13343561b8d4976c15a2e
4
- data.tar.gz: 73e4e30c1784431728ff2abb10e8892876b09662
3
+ metadata.gz: c312a2780882517deff930cdda229c0d7875c04c
4
+ data.tar.gz: 48cd2f694bd4e65ae3c2b2f423726303ca55d745
5
5
  SHA512:
6
- metadata.gz: 0a90311f9a8d3d976fa9da7bc816ca79ea3c47ae8eb8cb85a927b43401cd012b817c3838fce63cf74491458abc6f8ce5a5f2a56e9c71e81ae42f2b9378e621c7
7
- data.tar.gz: b0bdc690213884ffcbb08302972f8ba75d3de31094266816d25673dc66132f6dd2ea12f9b238613fc0a9a1c0c709cd5d4849d8c514bd0081af29075659c0992d
6
+ metadata.gz: 2433bab29e109e677264735240a3db7d104334070bc4e42b23b22e95b4831a58255415f8a783420cfd1e23c010a676905b7387df40a9ff7f5a1eb70ba39ec787
7
+ data.tar.gz: 0f32c5475ddfabae50a71eaf21bc4edad46470e024b0513de277562ca5ad6d014dbc2bda6b6021a94cf6d492bc80b7192ba9ab4203f672492c22322a4a8714cf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dex_sync (0.1.0)
4
+ dex_sync (0.1.1)
5
5
  faraday (~> 0.14.0)
6
6
  faraday-cookie_jar (~> 0.0.6)
7
7
  faraday_middleware (~> 0.12.2)
data/exe/dex_sync CHANGED
@@ -3,4 +3,4 @@
3
3
  require 'dex_sync'
4
4
 
5
5
  config = DexSync::Config.new
6
- DexSync::UpdateKubeConfigService.new(config).perform
6
+ DexSync::UpdateKubeConfigService.new(config).perform
data/lib/dex_sync.rb CHANGED
@@ -8,31 +8,35 @@ require 'yaml'
8
8
  module DexSync
9
9
  class Config
10
10
  def initialize
11
- @configuration = YAML.safe_load(File.read(File.expand_path('~/dex_sync.yaml')))
11
+ @config = YAML.safe_load(File.read(File.expand_path('~/dex_sync.yaml')))
12
12
  end
13
13
 
14
14
  def dex
15
- @configuration.fetch('DEX')
15
+ @config.fetch('DEX')
16
16
  end
17
17
 
18
- def github
19
- @configuration.fetch('GITHUB')
18
+ def domain
19
+ @config.fetch('DOMAIN', 'github.com')
20
20
  end
21
21
 
22
22
  def namespaces
23
- @configuration.fetch('NAMESPACES')
23
+ @config.fetch('NAMESPACES')
24
+ end
25
+
26
+ def download_path
27
+ @config.fetch('DOWNLOAD_PATH', '~/.kubeconfigs')
24
28
  end
25
29
 
26
30
  def clusters
27
- @configuration.fetch('CLUSTERS')
31
+ @config.fetch('CLUSTERS')
28
32
  end
29
33
 
30
34
  def user_session
31
- @configuration.fetch('USER_SESSION')
35
+ @config.fetch('USER_SESSION')
32
36
  end
33
37
 
34
38
  def gh_session
35
- @configuration.fetch('GH_SESSION')
39
+ @config.fetch('GH_SESSION')
36
40
  end
37
41
  end
38
42
 
@@ -66,11 +70,11 @@ module DexSync
66
70
 
67
71
  response = connection.post('download', download_params)
68
72
 
69
- config = YAML.safe_load(response.body)
73
+ downloaded_config = YAML.safe_load(response.body)
74
+
75
+ expanded_path = File.expand_path(@config.download_path + "/#{cluster}-#{namespace}-internal")
70
76
 
71
- File.open(File.expand_path("~/.kubeconfigs/#{cluster}-#{namespace}-internal"), 'w') do |f|
72
- f.write(config.to_yaml)
73
- end
77
+ File.open(expanded_path, 'w') { |f| f.write(downloaded_config.to_yaml) }
74
78
  end
75
79
  end
76
80
  end
@@ -98,7 +102,7 @@ module DexSync
98
102
  HTTP::Cookie.new(
99
103
  name: 'user_session',
100
104
  value: @config.user_session,
101
- domain: @config.github,
105
+ domain: @config.domain,
102
106
  path: '/'
103
107
  )
104
108
  end
@@ -107,9 +111,9 @@ module DexSync
107
111
  HTTP::Cookie.new(
108
112
  name: '_gh_sess',
109
113
  value: @config.gh_session,
110
- domain: @config.github,
114
+ domain: @config.domain,
111
115
  path: '/'
112
116
  )
113
117
  end
114
118
  end
115
- end
119
+ end
@@ -1,3 +1,3 @@
1
1
  module DexSync
2
- VERSION = "0.1.0"
2
+ VERSION = '0.1.1'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dex_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tony Hsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-08-17 00:00:00.000000000 Z
11
+ date: 2018-08-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler