id_service 0.1.2 → 0.2.0
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.
- data/bin/id_server +5 -0
- data/ext/id_server.yml +6 -0
- data/lib/id_service/server.rb +13 -0
- data/lib/id_service/version.rb +1 -1
- metadata +3 -2
data/bin/id_server
CHANGED
@@ -13,6 +13,10 @@ opts = OptionParser.new do |opts|
|
|
13
13
|
opts.separator ""
|
14
14
|
opts.separator "Options:"
|
15
15
|
|
16
|
+
opts.on('--config [CONFIG]') do |v|
|
17
|
+
@config = File.join(Dir.pwd, v)
|
18
|
+
end
|
19
|
+
|
16
20
|
opts.on('--host [HOST]') do |v|
|
17
21
|
@host = v
|
18
22
|
end
|
@@ -36,6 +40,7 @@ end
|
|
36
40
|
opts.parse!
|
37
41
|
|
38
42
|
options = {
|
43
|
+
config: @config,
|
39
44
|
hostname: @host,
|
40
45
|
port: @port,
|
41
46
|
host: @host_id,
|
data/ext/id_server.yml
ADDED
data/lib/id_service/server.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'thrift'
|
2
|
+
require 'yaml'
|
2
3
|
require 'active_support/core_ext'
|
3
4
|
|
4
5
|
require 'id_service/helpers'
|
@@ -13,6 +14,12 @@ module IdService
|
|
13
14
|
|
14
15
|
def initialize(options = {})
|
15
16
|
options.symbolize_keys!
|
17
|
+
\
|
18
|
+
|
19
|
+
unless options[:config].nil?
|
20
|
+
options = parse_config(options[:config]).merge(options)
|
21
|
+
end
|
22
|
+
|
16
23
|
options = default_options.merge(options)
|
17
24
|
|
18
25
|
options.each { |key, value| instance_variable_set('@' + key.to_s, value) }
|
@@ -27,6 +34,7 @@ module IdService
|
|
27
34
|
private
|
28
35
|
def default_options
|
29
36
|
{
|
37
|
+
config: nil,
|
30
38
|
hostname: 'localhost',
|
31
39
|
port: 9000,
|
32
40
|
host: 1,
|
@@ -34,5 +42,10 @@ module IdService
|
|
34
42
|
debug: false,
|
35
43
|
}
|
36
44
|
end
|
45
|
+
|
46
|
+
def parse_config(configfile)
|
47
|
+
config = YAML.load_file(configfile).symbolize_keys
|
48
|
+
config[:id_server]
|
49
|
+
end
|
37
50
|
end
|
38
51
|
end
|
data/lib/id_service/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: id_service
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -142,6 +142,7 @@ files:
|
|
142
142
|
- lib/id_service/types.rb
|
143
143
|
- lib/id_service/version.rb
|
144
144
|
- lib/id_service.rb
|
145
|
+
- ext/id_server.yml
|
145
146
|
- ext/IdService.thrift
|
146
147
|
- LICENSE
|
147
148
|
- README.md
|
@@ -159,7 +160,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
160
|
version: '0'
|
160
161
|
segments:
|
161
162
|
- 0
|
162
|
-
hash:
|
163
|
+
hash: 3226435786193218603
|
163
164
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
165
|
none: false
|
165
166
|
requirements:
|