stack_master-http_parameter_resolver 0.1.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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +19 -0
- data/LICENSE.txt +19 -0
- data/README.md +50 -0
- data/lib/stack_master/http_parameter_resolver.rb +5 -0
- data/lib/stack_master/http_parameter_resolver/version.rb +7 -0
- data/lib/stack_master/parameter_resolvers/http.rb +35 -0
- metadata +124 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: fcd1cd7bb9fb0f78115a09bb0a2a990ca2cf263e29d1dc0a3589e40e710d1e59
|
4
|
+
data.tar.gz: '09170f5e9461cca6b61d238bba746583aad21aefaeaf390f261bb8461d8ddc88'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: fb5b9976388731a4c57981156eede244eaa72b4ea143138e94e61276702d414dce3afe22fcf30cf4ab32642252f07480178909cbbabb9249bca6b23d8b4eaa9b
|
7
|
+
data.tar.gz: 8be7bc1d168741ba84c296f00fa4a54c379e1ee05f9e120a9981923a0b96422c188b0d8daa47feea48db350335b200bd3f12341e71ca504f1629b598a23eba18
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
All notable changes to this project will be documented in this file.
|
4
|
+
|
5
|
+
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
6
|
+
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
|
7
|
+
|
8
|
+
## [Unreleased]
|
9
|
+
|
10
|
+
[Unreleased]: https://github.com/envato/stack_master-http_parameter_resolver/compare/v0.1.0...HEAD
|
11
|
+
|
12
|
+
## [0.1.0] - 2020-01-14
|
13
|
+
|
14
|
+
### Added
|
15
|
+
|
16
|
+
- Initial functionality: Obtaining parameters from HTTP calls returning plain
|
17
|
+
text.
|
18
|
+
|
19
|
+
[v0.1.0]: https://github.com/envato/stack_master-http_parameter_resolver/tree/v0.1.0
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
Copyright (c) 2020 Envato PTY LTD
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
5
|
+
in the Software without restriction, including without limitation the rights
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
8
|
+
furnished to do so, subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
11
|
+
all copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
19
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,50 @@
|
|
1
|
+
# StackMaster::HttpParameterResolver
|
2
|
+
|
3
|
+
[](https://travis-ci.org/envato/stack_master-http_parameter_resolver)
|
4
|
+
|
5
|
+
A [StackMaster] parameter resolver that obtains values via HTTP calls.
|
6
|
+
|
7
|
+
[StackMaster]: https://github.com/envato/stack_master
|
8
|
+
|
9
|
+
## Installation
|
10
|
+
|
11
|
+
Add this line to your application's Gemfile:
|
12
|
+
|
13
|
+
```ruby
|
14
|
+
gem 'stack_master-http_parameter_resolver'
|
15
|
+
```
|
16
|
+
|
17
|
+
And then execute:
|
18
|
+
|
19
|
+
$ bundle
|
20
|
+
|
21
|
+
Or install it yourself as:
|
22
|
+
|
23
|
+
$ gem install stack_master-http_parameter_resolver
|
24
|
+
|
25
|
+
## Usage
|
26
|
+
|
27
|
+
For example, to resolve the Cloudflare IPv4 ranges:
|
28
|
+
|
29
|
+
```yaml
|
30
|
+
cloudflare_ips:
|
31
|
+
http: https://www.cloudflare.com/ips-v4
|
32
|
+
```
|
33
|
+
|
34
|
+
To obtain both the Cloudlare IPv4 and IPv6 ranges:
|
35
|
+
|
36
|
+
```yaml
|
37
|
+
cloudflare_ips:
|
38
|
+
- http: https://www.cloudflare.com/ips-v4
|
39
|
+
- http: https://www.cloudflare.com/ips-v6
|
40
|
+
```
|
41
|
+
|
42
|
+
## Development
|
43
|
+
|
44
|
+
After checking out the repo, run `script/setup` to install dependencies. You can also run `script/console` for an interactive prompt that will allow you to experiment.
|
45
|
+
|
46
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
47
|
+
|
48
|
+
## Contributing
|
49
|
+
|
50
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/envato/stack_master-http_parameter_resolver.
|
@@ -0,0 +1,35 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
|
5
|
+
module StackMaster
|
6
|
+
module ParameterResolvers
|
7
|
+
class Http < Resolver
|
8
|
+
NotResolved = Class.new(StandardError)
|
9
|
+
|
10
|
+
array_resolver
|
11
|
+
|
12
|
+
def initialize(_config, _stack_definition); end
|
13
|
+
|
14
|
+
def resolve(url)
|
15
|
+
response = connection(url).get
|
16
|
+
response.body.split(/\s+/)
|
17
|
+
rescue Faraday::Error
|
18
|
+
raise NotResolved, "Unable to resolve HTTP parameters from #{url}"
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def connection(url)
|
24
|
+
Faraday.new(
|
25
|
+
url: url,
|
26
|
+
params: {},
|
27
|
+
headers: { 'Accept' => 'text/plain' }
|
28
|
+
) do |connection|
|
29
|
+
connection.response :raise_error
|
30
|
+
connection.adapter :net_http
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
metadata
ADDED
@@ -0,0 +1,124 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: stack_master-http_parameter_resolver
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Envato
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2020-01-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: stack_master
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '3'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '3'
|
83
|
+
description:
|
84
|
+
email:
|
85
|
+
- rubygems@envato.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- CHANGELOG.md
|
91
|
+
- LICENSE.txt
|
92
|
+
- README.md
|
93
|
+
- lib/stack_master/http_parameter_resolver.rb
|
94
|
+
- lib/stack_master/http_parameter_resolver/version.rb
|
95
|
+
- lib/stack_master/parameter_resolvers/http.rb
|
96
|
+
homepage: https://github.com/envato/stack_master-http_parameter_resolver
|
97
|
+
licenses:
|
98
|
+
- MIT
|
99
|
+
metadata:
|
100
|
+
homepage_uri: https://github.com/envato/stack_master-http_parameter_resolver
|
101
|
+
bug_tracker_uri: https://github.com/envato/stack_master-http_parameter_resolver/issues
|
102
|
+
changelog_uri: https://github.com/envato/stack_master-http_parameter_resolver/blob/master/CHANGELOG.md
|
103
|
+
documentation_uri: https://www.rubydoc.info/gems/stack_master-http_parameter_resolver/0.1.0
|
104
|
+
source_code_uri: https://github.com/envato/stack_master-http_parameter_resolver/tree/v0.1.0
|
105
|
+
post_install_message:
|
106
|
+
rdoc_options: []
|
107
|
+
require_paths:
|
108
|
+
- lib
|
109
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: 2.4.0
|
114
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
requirements: []
|
120
|
+
rubygems_version: 3.1.2
|
121
|
+
signing_key:
|
122
|
+
specification_version: 4
|
123
|
+
summary: Obtain stack parameters from HTTP calls.
|
124
|
+
test_files: []
|