Skip to content

Commit faf6cfe

Browse files
authored
Merge pull request #117 from krakendio/v2.1
V2.1
2 parents 463ebf5 + e8ea4aa commit faf6cfe

8 files changed

+148
-28
lines changed

src/app/designer.controller.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ angular
177177
$rootScope.isEnterprise = function () {
178178
$rootScope.modules_in_use = [];
179179
service_components = ['documentation/openapi', 'auth/api-keys', 'telemetry/instana', 'telemetry/ganalytics'];
180-
endpoint_components = ['documentation/openapi', 'websocket'];
180+
endpoint_components = ['documentation/openapi', 'websocket', 'modifier/jmespath'];
181181
http_server_plugins = ['ip-filter','jwk-aggregator', 'krakend-afero', 'basic-auth', 'geoip', 'static-filesystem', 'redis-ratelimit', 'url-rewrite', 'virtualhost', 'wildcard'];
182182
http_client_plugins = ['wildcard', 'krakend-afero', 'static-filesystem', 'no-redirect'];
183183
req_resp_plugins = ['ip-filter'];

src/app/forms/endpoints.html

+14-9
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,14 @@ <h3 class="box-title">
279279
<label class="control-label">Rate limit by API Key</label>
280280
<div class="input-group">
281281
<input class="form-control"
282-
ng-model="endpoint.extra_config['auth/api-keys'].client_max_rate"
283-
id="endpoint.extra_config['auth/api-keys'].client_max_rate"
284-
name="endpoint.extra_config['auth/api-keys'].client_max_rate"
285-
type="number">
282+
ng-model="endpoint.extra_config['auth/api-keys'].client_max_rate"
283+
id="endpoint.extra_config['auth/api-keys'].client_max_rate"
284+
name="endpoint.extra_config['auth/api-keys'].client_max_rate"
285+
type="number">
286286
<div class="input-group-addon">reqs/sec</div>
287287
</div>
288-
<span class="help-block">Maximum requests per second you want to let each API-keys do. Leave <code>0</code> or empty for no limit.
288+
<span class="help-block">Maximum requests per second you want to let
289+
each API-keys do. Leave <code>0</code> or empty for no limit.
289290
</span>
290291
</div>
291292
</div>
@@ -305,6 +306,7 @@ <h3 class="box-title">
305306
plugin="'ip-filter'" type="'plugin/req-resp-modifier'"></plugin>
306307
<middleware template="jose_validator.html" namespace="'auth/validator'" data="endpoint">
307308
</middleware>
309+
<middleware template="jmespath.html" namespace="'modifier/jmespath'" data="endpoint"></middleware>
308310
</div>
309311
<div class="col-md-6">
310312
<middleware template="websocket.html" namespace="'websocket'" data="endpoint">
@@ -373,6 +375,8 @@ <h3>Request</h3>
373375
ng-change="syncHostsInBackend(endpoint_index, backend_index, checked, host.host, host.disable_host_sanitize)">
374376
{{ host.host }}
375377
</label>
378+
<span class="help-block">All the hosts (round-robin) that can be used to
379+
request the URL</span>
376380
</div>
377381
<div class="radio-inline" ng-repeat="sd in sd_providers.providers">
378382
<label>
@@ -400,7 +404,7 @@ <h3>Request</h3>
400404
</select>
401405
</div>
402406
<div class="col-md-4">
403-
<label>Backend endpoint</label>
407+
<label>URL</label>
404408
<input type="text" placeholder="/users/{username}" class="form-control"
405409
required="" ng-model="backend.url_pattern">
406410

@@ -443,9 +447,9 @@ <h3>Request</h3>
443447
</div>
444448
<div class="col-md-6">
445449
<middleware data="backend"
446-
inherit="service.extra_config['auth/client-credentials']"
447-
template="oauth.html" namespace="'auth/client-credentials'">
448-
</middleware>
450+
inherit="service.extra_config['auth/client-credentials']"
451+
template="oauth.html" namespace="'auth/client-credentials'">
452+
</middleware>
449453
<middleware data="backend" template="amqp_producer.html"
450454
namespace="'backend/amqp/producer'"></middleware>
451455
</div>
@@ -641,6 +645,7 @@ <h3 class="box-title">Static Response (stub data)</h3>
641645
Add static response (stub)
642646
</button>
643647
</div>
648+
</div>
644649
</fieldset>
645650
</form>
646651
</div><!-- /.box-body -->

src/app/layout.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ <h4 class="modal-title">You have added KrakenD Enterprise features
116116
</ul>
117117
<p>The process of upgrading or downgrading between versions is transparent for you and without needing to change configurations.</p>
118118

119-
<p><a class="btn btn-success" href="https://www.krakend.io/enterprise/#contact-sales">Request a trial LICENSE</a></p>
119+
<p><a class="btn btn-success" href="https://www.krakend.io/enterprise/?utm_campaign=designer#contact-sales">Request a trial LICENSE</a></p>
120120
</div>
121121
</div>
122122
</div>

src/app/middlewares/gologging.html

+33-12
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,40 @@ <h3 class="box-title"><input type="checkbox" ng-checked="isMiddlewareEnabled()"
6262
</div>
6363
</div>
6464
<h4>Send logs to...</h4>
65-
<div class="form-group">
66-
<div class="checkbox">
67-
<label>
68-
<input type="checkbox" value="syslog" ng-model="data.extra_config[config_namespace].syslog">
69-
<strong>Syslog</strong> - Send logs to syslog
70-
</label>
65+
<div class="row">
66+
<div class="col-md-6">
67+
<div class="form-group">
68+
<div class="checkbox">
69+
<label>
70+
<input type="checkbox" value="syslog" ng-model="data.extra_config[config_namespace].syslog">
71+
<strong>Syslog</strong> - Remote or local server
72+
</label>
73+
</div>
74+
<div class="checkbox">
75+
<label>
76+
<input type="checkbox" value="stdout" ng-model="data.extra_config[config_namespace].stdout">
77+
<strong>Stdout</strong> - Console
78+
</label>
79+
</div>
80+
</div>
7181
</div>
72-
<div class="checkbox">
73-
<label>
74-
<input type="checkbox" value="stdout" ng-model="data.extra_config[config_namespace].stdout">
75-
<strong>Stdout</strong> - Send logs to standard out
76-
</label>
82+
<div class="col-md-6" ng-if="data.extra_config[config_namespace].syslog">
83+
<label class="control-label">Syslog Facility</label>
84+
<select class="form-control" ng-model="data.extra_config[config_namespace].syslog_facility"
85+
id="data.extra_config[config_namespace].syslog_facility"
86+
name="data.extra_config[config_namespace].syslog_facility">
87+
<option value="local0">local 0</option>
88+
<option value="local1">local 1</option>
89+
<option value="local2">local 2</option>
90+
<option value="local3">local 3</option>
91+
<option value="local4">local 4</option>
92+
<option value="local5">local 5</option>
93+
<option value="local6">local 6</option>
94+
<option value="local7">local 7</option>
95+
</select>
96+
<span class="help-block">Facility to send the messages as set in the rsyslog standard</span>
7797
</div>
7898
</div>
7999
</div>
80-
</div>
100+
</div>
101+
</div>

src/app/middlewares/jmespath.html

+46
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
<div class="box box-info box-solid">
2+
<div class="box-header with-border">
3+
<h3 class="box-title">
4+
<input type="checkbox" ng-checked="isMiddlewareEnabled()" ng-click="toggleMiddleware()"> Advanced response
5+
manipulation (JMESpath)
6+
</h3>
7+
<div class="pull-right">
8+
<span class="pull-right-container badge badge-inverse">Enterprise</span>
9+
</div>
10+
</div>
11+
<div class="box-body">
12+
<p>Manipulate the response dataset after the aggregation layer using a JSON Query language.</p>
13+
<div ng-if="isMiddlewareEnabled()">
14+
15+
<div class="form-group row">
16+
<div class="col-md-12">
17+
<label class="control-label">Expression for {{ data.endpoint }}</label>
18+
<input type="text" class="form-control" ng-model="data.extra_config[config_namespace].expr"
19+
placeholder="students[?age > `18` ].name">
20+
<span class="help-block">JMESpath query</span>
21+
</div>
22+
</div>
23+
<h4>Example of how JMESpath works</h4>
24+
<div class="form-group row">
25+
<div class="col-md-6">
26+
<label>Aggregated backend responses</label>
27+
<pre>{
28+
"students": [
29+
{"name": "Bill", "age": 23 },
30+
{"name": "Mary", "age": 16 },
31+
{"name": "Jessica", "age": 19 }
32+
]
33+
}</pre>
34+
</div>
35+
<div class="col-md-6">
36+
<label>Expression</label>
37+
<pre>students[?age > `18` ].name</pre>
38+
39+
<label>Final response</label>
40+
<pre>["Bill", "Jessica"]</pre>
41+
<p><a href="https://www.krakend.io/docs/enterprise/endpoints/jmespath/"><i class="fa fa-book"></i> JMESpath documentation</a></p>
42+
</div>
43+
</div>
44+
</div>
45+
</div>
46+
</div>

src/app/middlewares/ratelimit_router.html

+26
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,19 @@
2121
<span class="help-block">Maximum requests per second you want to let this endpoint handle. Leave <code>0</code> for no default limit.
2222
</span>
2323
</div>
24+
<div class="form-group" ng-class="validator.isInteger(data.extra_config[config_namespace].capacity) ? '' : 'has-error'">
25+
<label class="control-label">Capacity</label>
26+
<div class="input-group">
27+
<input class="form-control"
28+
ng-model="data.extra_config[config_namespace].capacity"
29+
id="data.extra_config[config_namespace].capacity"
30+
name="data.extra_config[config_namespace].capacity"
31+
type="number">
32+
<div class="input-group-addon">tokens</div>
33+
</div>
34+
<span class="help-block">Number of tokens you can store in the Token Bucket. Traduces into maximum concurrent requests this endpoint will accept for all users.
35+
</span>
36+
</div>
2437
<div class="form-group" ng-class="validator.isInteger(data.extra_config[config_namespace].client_max_rate) ? '' : 'has-error'">
2538
<label class="control-label">Default user quota</label>
2639
<div class="input-group">
@@ -54,4 +67,17 @@
5467
</div>
5568
</div>
5669
</div>
70+
<div class="form-group" ng-class="validator.isInteger(data.extra_config[config_namespace].client_capacity) ? '' : 'has-error'">
71+
<label class="control-label">Client capacity</label>
72+
<div class="input-group">
73+
<input class="form-control"
74+
ng-model="data.extra_config[config_namespace].client_capacity"
75+
id="data.extra_config[config_namespace].client_capacity"
76+
name="data.extra_config[config_namespace].client_capacity"
77+
type="number">
78+
<div class="input-group-addon">tokens</div>
79+
</div>
80+
<span class="help-block">Number of tokens you can store in the Token Bucket for each individual user. Traduces into maximum concurrent requests this endpoint will accept for the connected user.
81+
</span>
82+
</div>
5783
</div>

src/app/service/http_client_settings.html

+18-2
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ <h4>Timeouts</h4>
5858
<h4>Connections</h4>
5959
</div>
6060
<div class="form-group">
61-
<div class="col-md-3" ng-class="isInteger(service.max_idle_connections) ? '' : 'has-error'">
61+
<div class="col-md-2" ng-class="isInteger(service.max_idle_connections) ? '' : 'has-error'">
6262
<label class="control-label">Maximum IDLE connections</label>
6363
<input class="form-control"
6464
ng-model="service.max_idle_connections"
6565
type="text">
6666
<span class="help-block">Maximum number of idle (keep-alive) connections across all hosts. <code>0</code> means no limit.
6767
</span>
6868
</div>
69-
<div class="col-md-3" ng-class="isInteger(service.max_idle_connections_per_host) ? '' : 'has-error'">
69+
<div class="col-md-2" ng-class="isInteger(service.max_idle_connections_per_host) ? '' : 'has-error'">
7070
<label class="control-label">Maximum IDLE connections per host</label>
7171
<input class="form-control"
7272
ng-model="service.max_idle_connections_per_host"
@@ -75,6 +75,22 @@ <h4>Connections</h4>
7575
Defaults to <code>250</code>.
7676
</span>
7777
</div>
78+
<div class="col-md-2">
79+
<div class="checkbox">
80+
<label for="service.allow_insecure_connections">
81+
<input type="checkbox"
82+
id="service.allow_insecure_connections"
83+
name="service.allow_insecure_connections"
84+
ng-model="service.allow_insecure_connections"
85+
placeholder="0s"
86+
type="text">
87+
<strong>Allow insecure connections</strong>
88+
</label>
89+
<div class="help-block">
90+
<p>E.g.: when using self-signed certificates</p>
91+
</div>
92+
</div>
93+
</div>
7894
<div class="col-md-3">
7995
<div class="checkbox">
8096
<label for="service.disable_keep_alives">

src/app/services/default_config.service.js

+9-3
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,8 @@ angular
9090
"prefix": "[KRAKEND]",
9191
"syslog": false,
9292
"stdout": true,
93-
"format": "default"
93+
"format": "default",
94+
"syslog_facility": "local3"
9495
},
9596
'security/cors': {
9697
"allow_origins": [
@@ -144,11 +145,13 @@ angular
144145
"operationName": "addMktPreferencesForUser",
145146
"variables": {}
146147
},
147-
// // Endpoint level middleware (github.com)
148+
// // Endpoint level middleware
148149
'qos/ratelimit/router': {
149150
"max_rate": 0,
150151
"client_max_rate": 0,
151-
"strategy": "ip"
152+
"strategy": "ip",
153+
"capacity": 0,
154+
"client_capacity": 0
152155
},
153156
'auth/signer': {
154157
"alg": "HS256"
@@ -185,6 +188,9 @@ angular
185188
"ping_period": "54s",
186189
"max_retries": 0,
187190
"backoff_strategy": "exponential"
191+
},
192+
"modifier/jmespath": {
193+
"expr": "people[?age > `20`].[name, age]"
188194
}
189195
},
190196
"plugin/http-server": {

0 commit comments

Comments
 (0)