scc_ruby 0.1.1 → 0.1.2
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/Gemfile.lock +1 -1
- data/README.md +3 -3
- data/lib/scc_ruby/version.rb +1 -1
- data/lib/scc_ruby.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fe6f4fdb28dc28fd2129a787ecab34ea099fe78408e4b1b32bf2ce2e7170ba58
|
4
|
+
data.tar.gz: 9f1d8e235999de686f36476c98a1cb7e4a62f1bd9dfb0db397ee973c38334669
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d46c7d5fe48d0fd2ad01082fe95c98e419921dce8b20617c73330794907215d8dcbdc66ce5e2d13d3c39b38a79b4b36c7ce99cd3bca183f12f6dcd48ae63890e
|
7
|
+
data.tar.gz: 9dfe974bb276d7682e2331dfba270055c162b02a0999b1749e65316f1308cc76fe781a22ed645fccc8e0f8be6047ff2dd1d94960207fcedd80319996d3b2612f
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# SccRuby
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Spring cloud config client in ruby, just return a hash.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
@@ -24,6 +22,8 @@ Or install it yourself as:
|
|
24
22
|
|
25
23
|
```ruby
|
26
24
|
h = SccRuby::Api.fetch('config_server_url', 'app_name', Rails.env)
|
25
|
+
# or
|
26
|
+
h = SccRuby::Api.fetch('config_server_url', 'app_name', Rails.env, 'basic_auth_username', 'basic_auth_password')
|
27
27
|
pp h
|
28
28
|
```
|
29
29
|
|
data/lib/scc_ruby/version.rb
CHANGED
data/lib/scc_ruby.rb
CHANGED
@@ -4,9 +4,13 @@ require 'json'
|
|
4
4
|
|
5
5
|
module SccRuby
|
6
6
|
class Api
|
7
|
-
def self.fetch(config_server_url, app_name, app_env = 'default')
|
7
|
+
def self.fetch(config_server_url, app_name, app_env = 'default', basic_auth_username = '', basic_auth_password = '')
|
8
8
|
uri = URI(build_url(config_server_url, app_name, app_env))
|
9
|
-
|
9
|
+
req = Net::HTTP::Get.new(uri)
|
10
|
+
req.basic_auth(basic_auth_username, basic_auth_password) unless basic_auth_username.empty? && basic_auth_password.empty?
|
11
|
+
res = Net::HTTP.start(uri.hostname, uri.port) do |http|
|
12
|
+
http.request(req)
|
13
|
+
end
|
10
14
|
|
11
15
|
if res.code != '200'
|
12
16
|
raise "Fail to fetch from spring cloud config server, http code #{res.code}, message #{res.message}"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: scc_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FlowerWrong
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|