skull_island 2.0.0 → 2.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +1 -1
- data/lib/core_extensions/hash/pruning.rb +27 -0
- data/lib/skull_island/resources/plugin.rb +1 -1
- data/lib/skull_island/resources/upstream.rb +6 -1
- data/lib/skull_island/version.rb +1 -1
- data/lib/skull_island.rb +2 -0
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a5d7af669323fdbe1216566cf8baeba91724c2292de92a283d39cd3bd1aac4e
|
4
|
+
data.tar.gz: 55cf31d7419e2cb52f132bf906a02de85d5f79c97bbb2c63f3b8d25889c92af1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 335c95cdfbb85ba6979b1d2460ea317fb5aff1207edcd24ebda4fb1974b9e0204bed1e52fd99ad703a809fbaef65517095c1521341e857c5e09be50223393553
|
7
|
+
data.tar.gz: 002752d03a6dfd2ce7caae75389765608f24dcbfdef00bf7ed85a3fa5c18b82e58de35f9466bce9e7d7f77976af8d17d17d73e6407b41783e6f7d29565c87c27
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -282,7 +282,7 @@ While technically _any_ Ruby is valid, the following are pretty helpful for temp
|
|
282
282
|
|
283
283
|
* `ENV.fetch('VARIABLE_NAME', 'default value')` - This allows looking up the environment variable `VARIABLE_NAME` and using its value, or, if it isn't defined, it uses `default value` as the value. With this we could change `host: api.example.com` to `host: <%= ENV.fetch('API_HOST', 'api.example.com') %>`. With this, if `API_HOST` is provided, it'll use that, otherwise it will default to `api.example.com`. This is especially helpful for sensitive information; you can version control the configuration but pass in things like credentials via environment variables at runtime.
|
284
284
|
|
285
|
-
Note also that 1.4.x and beyond of Skull Island support two phases of embedded ruby: first, a simple phase that treats the **entire file** as just text, allowing you to use the full power of ruby for things like loops, conditional logic, and more; the second phase is applied for individual attributes within the rendered YAML document. This is where the `lookup()` function above is used.
|
285
|
+
Note also that 1.4.x and beyond of Skull Island support two phases of embedded ruby: first, a simple phase that treats the **entire file** as just text, allowing you to use the full power of ruby for things like loops, conditional logic, and more; the second phase is applied for individual attributes within the rendered YAML document. This is where the `lookup()` function above is used.
|
286
286
|
|
287
287
|
## SDK Usage
|
288
288
|
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module CoreExtensions
|
4
|
+
module Hash
|
5
|
+
# Monkey-patches for Hash to add some recursive pruning options
|
6
|
+
module Pruning
|
7
|
+
# Recursively strips empty and nil elements from a Hash
|
8
|
+
# @return [Hash]
|
9
|
+
def prune
|
10
|
+
newhash = {}
|
11
|
+
|
12
|
+
each do |k, v|
|
13
|
+
if v.is_a?(Hash)
|
14
|
+
newvalue = v.prune
|
15
|
+
newhash[k] = newvalue unless newvalue.empty?
|
16
|
+
elsif v.respond_to?(:empty?)
|
17
|
+
newhash[k] = v unless v.empty?
|
18
|
+
else
|
19
|
+
newhash[k] = v unless v.nil?
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
newhash
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -18,7 +18,7 @@ module SkullIsland
|
|
18
18
|
property :hash_fallback_header, validate: true
|
19
19
|
property :hash_on_cookie, validate: true
|
20
20
|
property :hash_on_cookie_path, validate: true
|
21
|
-
property :healthchecks, validate: true
|
21
|
+
property :healthchecks, validate: true, postprocess: true
|
22
22
|
property :host_header, validate: true
|
23
23
|
property :created_at, read_only: true, postprocess: true
|
24
24
|
property :tags, validate: true, preprocess: true, postprocess: true
|
@@ -160,6 +160,11 @@ module SkullIsland
|
|
160
160
|
|
161
161
|
private
|
162
162
|
|
163
|
+
# Prunes empty values from the healthchecks Hash
|
164
|
+
def postprocess_healthchecks(value)
|
165
|
+
value.is_a?(Hash) ? value.prune : value
|
166
|
+
end
|
167
|
+
|
163
168
|
# Validates the upstream balancing {#algorithm}
|
164
169
|
def validate_algorithm(value)
|
165
170
|
%w[round-robin consistent-hashing least-connections].include?(value)
|
data/lib/skull_island/version.rb
CHANGED
data/lib/skull_island.rb
CHANGED
@@ -2,7 +2,9 @@
|
|
2
2
|
|
3
3
|
# Core Extensions
|
4
4
|
require 'core_extensions/string/transformations'
|
5
|
+
require 'core_extensions/hash/pruning'
|
5
6
|
String.include CoreExtensions::String::Transformations
|
7
|
+
Hash.include CoreExtensions::Hash::Pruning
|
6
8
|
|
7
9
|
# Standard Library Requirements
|
8
10
|
require 'date'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: skull_island
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jonathan Gnagy
|
@@ -241,6 +241,7 @@ files:
|
|
241
241
|
- bin/console
|
242
242
|
- bin/setup
|
243
243
|
- exe/skull_island
|
244
|
+
- lib/core_extensions/hash/pruning.rb
|
244
245
|
- lib/core_extensions/string/transformations.rb
|
245
246
|
- lib/skull_island.rb
|
246
247
|
- lib/skull_island/api_client.rb
|