kongfigure 0.0.3 → 0.0.4
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/lib/kongfigure/cli.rb +3 -0
- data/lib/kongfigure/configuration.rb +2 -2
- data/lib/kongfigure/http_client.rb +2 -2
- data/lib/kongfigure/parser.rb +4 -3
- data/lib/kongfigure/services/plugin.rb +1 -1
- data/lib/kongfigure/version.rb +1 -1
- data/lib/kongfigure.rb +1 -1
- 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: cf57cebf09bbe6f5d2a0be2ef0b963d26b8482fdf3be87d38308db576593effe
|
4
|
+
data.tar.gz: f072f428db96554d2fd79b1121af4fe414cf8a61153d71ff853d3720f71b59fc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 90325a8f142dbf70982d3d3d5e05d8f1d7eb9c85d5283c202334cc32c9fb97b500768a24b81b909e27522b4b0e94f8c09c0ed54b89a441f6c17b0545b2f726a4
|
7
|
+
data.tar.gz: 114692c7a0dae4e049cfd0b5441d2817ceeb7bf126fb8a922ff0c82aa7811846b1efe1cd962400927b421bb5aa8488ee0f9f838547069c021118b77b6c324ebe
|
data/lib/kongfigure/cli.rb
CHANGED
@@ -10,6 +10,9 @@ module Kongfigure
|
|
10
10
|
parser.on("-f", "--file FILE", "Path to the Kongfigure configuration file.") do |file|
|
11
11
|
@options[:file] = file
|
12
12
|
end
|
13
|
+
parser.on("-u", "--url URL", "Url to the kong admin API.") do |url|
|
14
|
+
@options[:url] = url
|
15
|
+
end
|
13
16
|
end
|
14
17
|
end
|
15
18
|
|
@@ -5,10 +5,10 @@ require "awesome_print"
|
|
5
5
|
module Kongfigure
|
6
6
|
class Configuration
|
7
7
|
|
8
|
-
attr_accessor :
|
8
|
+
attr_accessor :url, :services, :consumers, :plugins, :upstreams
|
9
9
|
|
10
10
|
def initialize
|
11
|
-
@
|
11
|
+
@url = nil
|
12
12
|
@services = []
|
13
13
|
@consumers = []
|
14
14
|
@plugins = []
|
@@ -9,11 +9,11 @@ module Kongfigure
|
|
9
9
|
accept_encoding: "gzip"
|
10
10
|
}
|
11
11
|
|
12
|
-
def initialize
|
12
|
+
def initialize(parser, url)
|
13
13
|
@configuration = {
|
14
14
|
ssl_ca_path: nil,
|
15
15
|
verify_ssl: OpenSSL::SSL::VERIFY_NONE,
|
16
|
-
url:
|
16
|
+
url: url || parser.parse!.url
|
17
17
|
}
|
18
18
|
@inflector = Dry::Inflector.new
|
19
19
|
end
|
data/lib/kongfigure/parser.rb
CHANGED
@@ -5,15 +5,16 @@ module Kongfigure
|
|
5
5
|
|
6
6
|
def initialize(file)
|
7
7
|
@yaml_configuration = File.read(file)
|
8
|
-
@configuration = Kongfigure::Configuration.new
|
9
8
|
end
|
10
9
|
|
11
10
|
def parse!
|
11
|
+
return @configuration unless @configuration.nil?
|
12
|
+
@configuration = Kongfigure::Configuration.new
|
12
13
|
puts "Parsing YAML configuration...".colorize(:color => :white, :background => :red)
|
13
14
|
YAML.load(@yaml_configuration).each do |key, value|
|
14
15
|
case key
|
15
|
-
when "
|
16
|
-
@configuration.
|
16
|
+
when "url"
|
17
|
+
@configuration.url = value
|
17
18
|
when "services"
|
18
19
|
@configuration.add_services(value || [])
|
19
20
|
when "consumers"
|
@@ -11,7 +11,7 @@ module Kongfigure::Services
|
|
11
11
|
|
12
12
|
def cleanup(http_client, resource, related_resource)
|
13
13
|
return unless related_resource.is_global?
|
14
|
-
puts "-> Cleanup #{
|
14
|
+
puts "-> Cleanup #{related_resource.class.name} (#{related_resource.identifier}).".colorize(:magenta)
|
15
15
|
http_client.delete("#{resource_name}/#{related_resource.id}")
|
16
16
|
end
|
17
17
|
end
|
data/lib/kongfigure/version.rb
CHANGED
data/lib/kongfigure.rb
CHANGED
@@ -39,7 +39,7 @@ module Kongfigure
|
|
39
39
|
options = cli.parse!(args)
|
40
40
|
# Parser
|
41
41
|
parser = Kongfigure::Parser.new(options[:file])
|
42
|
-
http_client = Kongfigure::HTTPClient.new
|
42
|
+
http_client = Kongfigure::HTTPClient.new(parser, options[:url])
|
43
43
|
kong = Kongfigure::Kong.new(parser, http_client)
|
44
44
|
kong.apply!
|
45
45
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kongfigure
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ibanity
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|