Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[config] add support to filter services by endpoint. #1022

Merged
merged 3 commits into from
Apr 30, 2019

Conversation

eloycoto
Copy link
Contributor

This commit adds the option to filter services based on the endpoint.
This commit expose a new config flag using the env variable
APICAST_SERVICES_FILTER, services filter happens on
configuration.filter_services.

Signed-off-by: Eloy Coto eloy.coto@gmail.com

doc/parameters.md Outdated Show resolved Hide resolved
doc/parameters.md Outdated Show resolved Hide resolved
doc/parameters.md Outdated Show resolved Hide resolved
### `APICAST_SERVICES_FILTER`
**Value:** a regegular expression
**Default:**: .*
**Example:** *.example.com
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will it be possible to supply multiple patterns? I totally could see that there will be two wildcards in some cases.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. Based on the code it looks like this should be a regex, but from the example, it looks like a wildcard.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should be clear now ;-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*.example.com is not valid PCRE no?

@eloycoto eloycoto force-pushed the THREESCALE-1524 branch 6 times, most recently from 16e837e to c06bb02 Compare April 26, 2019 09:11
@eloycoto eloycoto marked this pull request as ready for review April 26, 2019 09:11
@eloycoto eloycoto requested review from a team as code owners April 26, 2019 09:11
CHANGELOG.md Outdated Show resolved Hide resolved
doc/parameters.md Outdated Show resolved Hide resolved
Copy link
Contributor

@porueesq porueesq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some minor changes to apply.


it("combination with service list", function()
env.set('APICAST_SERVICES_FILTER_BY_URL', '^test.*')
assert.same(filter_services(mockservices, {"21"}), {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this test be clearer if the 2 variables were set at the beginning and we had a single assert?

doc/parameters.md Outdated Show resolved Hide resolved
Migrated t/apicast-subset-of-services.t tests to the new testing
Blackbox schema

Signed-off-by: Eloy Coto <eloy.coto@gmail.com>
@eloycoto eloycoto force-pushed the THREESCALE-1524 branch 3 times, most recently from c1a6267 to 01f8778 Compare April 26, 2019 15:29
@eloycoto eloycoto requested review from porueesq and davidor April 26, 2019 15:32
@eloycoto eloycoto force-pushed the THREESCALE-1524 branch 2 times, most recently from e8b95b3 to a3b9fdd Compare April 29, 2019 10:40
**Default:**: .*
**Example:** *.example.com

Used to filter the service configured in the 3scale API Manager, the filter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We probably should mention the filter is PCRE.

This commit adds the option to filter services based on the endpoint.
This commit expose a new config flag using the env variable
`APICAST_SERVICES_FILTER_BY_URL`, services filter happens on
`configuration.filter_services`.

Signed-off-by: Eloy Coto <eloy.coto@gmail.com>
This test validates that the parameter `APICAST_SERVICE_FILTER_BY_URL`
is working correctly across multiple services and the service discarding
is working correctly.

Signed-off-by: Eloy Coto <eloy.coto@gmail.com>
Copy link
Contributor

@mikz mikz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@mikz
Copy link
Contributor

mikz commented Apr 30, 2019

:shipit: ?

@davidor davidor merged commit 77b7de0 into 3scale:master Apr 30, 2019
@davidor davidor added this to the 3.6 milestone May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants