From 42e5588b7feb13e90964b5371fb9f1bdcfaf793a Mon Sep 17 00:00:00 2001 From: Paul Bonaud Date: Thu, 8 Aug 2019 15:51:47 +0200 Subject: config(dhall): add parameter 'generator' to CorrelationID plugin This PR adds possibility to define a custom `generator` to use in the CorrelationID plugin. The default value ("uuid#counter") is taken from Kong directly https://docs.konghq.com/hub/kong-inc/correlation-id/#parameters --- dhall/server/service/plugin/Config.dhall | 4 ++-- dhall/server/service/plugin/CorrelationId.dhall | 26 ++++++++++++++++++------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/dhall/server/service/plugin/Config.dhall b/dhall/server/service/plugin/Config.dhall index d54436b..ea53361 100644 --- a/dhall/server/service/plugin/Config.dhall +++ b/dhall/server/service/plugin/Config.dhall @@ -1,9 +1,9 @@ < CorrelationId : - { header_name : Text, echo_downstream : Bool } + { header_name : Text, echo_downstream : Bool, generator : Text } | RequestTransformer : { add : { headers : List Text } } | RequestTermination : { status_code : Natural, content_type : Text, body : Text } | IPRestriction : { whitelist : Text } -> \ No newline at end of file +> diff --git a/dhall/server/service/plugin/CorrelationId.dhall b/dhall/server/service/plugin/CorrelationId.dhall index 655cd8d..fc69f4f 100644 --- a/dhall/server/service/plugin/CorrelationId.dhall +++ b/dhall/server/service/plugin/CorrelationId.dhall @@ -2,10 +2,22 @@ let Plugin = ./Plugin.dhall let config = ./Config.dhall -in { name = - "correlation-id" - , config = - config.CorrelationId - { header_name = "X-correl", echo_downstream = True } - } - : Plugin +in λ(generator : Optional Text) + → { name = + "correlation-id" + , config = + config.CorrelationId + { header_name = + "X-correl" + , echo_downstream = + True + , generator = + Optional/fold + Text + generator + Text + (λ(t : Text) → t) + "uuid#counter" + } + } + : Plugin -- cgit v1.2.3