From 25bf64cbc9a8ed4fef36c15756f9d7f8e96e2d06 Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Thu, 3 Oct 2019 11:31:56 +0200 Subject: [PATCH] upgrade dhall to 1.26.1 and merge types and terms Previously, types were flattened and terms were nested (as are the directories). For consistency, I made the types nested as well. --- .travis.yml | 2 +- dhall-1.21.0.nix => dhall-1.26.1.nix | 2 +- dhall/.gitignore | 1 + dhall/Config.dhall | 3 ++- dhall/package.dhall | 4 ++++ dhall/server/Server.dhall | 9 -------- dhall/server/functions.dhall | 1 - dhall/server/mkServer.dhall | 17 -------------- dhall/server/package.dhall | 21 +++++++++++++++++ dhall/server/service/{route => }/Route.dhall | 0 dhall/server/service/Service.dhall | 4 ++-- dhall/server/service/functions.dhall | 1 - dhall/server/service/package.dhall | 12 ++++++++++ .../server/service/plugin/CorrelationId.dhall | 23 ------------------- .../server/service/plugin/correlationId.dhall | 23 +++++++++++++++++++ dhall/server/service/plugin/functions.dhall | 9 -------- dhall/server/service/plugin/package.dhall | 6 +++++ 17 files changed, 73 insertions(+), 65 deletions(-) rename dhall-1.21.0.nix => dhall-1.26.1.nix (87%) create mode 100644 dhall/.gitignore create mode 100644 dhall/package.dhall delete mode 100644 dhall/server/Server.dhall delete mode 100644 dhall/server/functions.dhall delete mode 100644 dhall/server/mkServer.dhall create mode 100644 dhall/server/package.dhall rename dhall/server/service/{route => }/Route.dhall (100%) delete mode 100644 dhall/server/service/functions.dhall create mode 100644 dhall/server/service/package.dhall delete mode 100644 dhall/server/service/plugin/CorrelationId.dhall create mode 100644 dhall/server/service/plugin/correlationId.dhall delete mode 100644 dhall/server/service/plugin/functions.dhall create mode 100644 dhall/server/service/plugin/package.dhall diff --git a/.travis.yml b/.travis.yml index 029c1a9..7bf8ed8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,7 @@ sudo: false install: # Install ansible - nix-env -i python2.7-ansible python2.7-ansible-lint - - nix-env -if ./dhall-1.21.0.nix + - nix-env -if ./dhall-1.26.1.nix # Check ansible version - ansible --version diff --git a/dhall-1.21.0.nix b/dhall-1.26.1.nix similarity index 87% rename from dhall-1.21.0.nix rename to dhall-1.26.1.nix index e53369b..918a528 100644 --- a/dhall-1.21.0.nix +++ b/dhall-1.26.1.nix @@ -19,4 +19,4 @@ let ''; }; in - mkVersion "1.21.0" "0x7q6v1y62fq6724kx1hcfp1fcqv3lbv33ji6jzfd5y316a31r77" + mkVersion "1.26.1" "0sl4r3mfairgd6kn26hs1r1lkh8rn992grd73078rhqf5w90ag05" diff --git a/dhall/.gitignore b/dhall/.gitignore new file mode 100644 index 0000000..8f5fd87 --- /dev/null +++ b/dhall/.gitignore @@ -0,0 +1 @@ +.history diff --git a/dhall/Config.dhall b/dhall/Config.dhall index f1a28fc..dad94f9 100644 --- a/dhall/Config.dhall +++ b/dhall/Config.dhall @@ -1 +1,2 @@ -let Server = ./server/Server.dhall in { kong_servers : List Server } +let Server = ./server/package.dhall in { kong_servers : List Server.Type } + diff --git a/dhall/package.dhall b/dhall/package.dhall new file mode 100644 index 0000000..53461ae --- /dev/null +++ b/dhall/package.dhall @@ -0,0 +1,4 @@ +{ Vault = ./Vault.dhall +, Config = ./Config.dhall +, Server = ./server/package.dhall +} diff --git a/dhall/server/Server.dhall b/dhall/server/Server.dhall deleted file mode 100644 index beddd7d..0000000 --- a/dhall/server/Server.dhall +++ /dev/null @@ -1,9 +0,0 @@ - let Service = ./service/Service.dhall - -in { kong_app_admin_url : - Text - , kong_app_admin_apikey : - Text - , services : - List Service - } diff --git a/dhall/server/functions.dhall b/dhall/server/functions.dhall deleted file mode 100644 index 2775fb9..0000000 --- a/dhall/server/functions.dhall +++ /dev/null @@ -1 +0,0 @@ -{ Service = ./service/functions.dhall, mkServer = ./mkServer.dhall } diff --git a/dhall/server/mkServer.dhall b/dhall/server/mkServer.dhall deleted file mode 100644 index f02055b..0000000 --- a/dhall/server/mkServer.dhall +++ /dev/null @@ -1,17 +0,0 @@ - let Server = ./Server.dhall - -in let Service = ./service/Service.dhall - -in let Vault = ./../Vault.dhall - -in λ(vault : Vault) - → λ(adminUrl : Text) - → λ(services : List Service) - → { kong_app_admin_url = - adminUrl - , kong_app_admin_apikey = - vault.appAdminApiKey - , services = - services - } - : Server diff --git a/dhall/server/package.dhall b/dhall/server/package.dhall new file mode 100644 index 0000000..e9e398c --- /dev/null +++ b/dhall/server/package.dhall @@ -0,0 +1,21 @@ +let Service = ./service/package.dhall + +let Server = + { kong_app_admin_url : Text + , kong_app_admin_apikey : Text + , services : List Service.Type + } + +let Vault = ./../Vault.dhall + +let mkServer = + λ(vault : Vault) + → λ(adminUrl : Text) + → λ(services : List Service.Type) + → { kong_app_admin_url = adminUrl + , kong_app_admin_apikey = vault.appAdminApiKey + , services = services + } + : Server + +in { Service = Service, Type = Server, mkServer = mkServer } diff --git a/dhall/server/service/route/Route.dhall b/dhall/server/service/Route.dhall similarity index 100% rename from dhall/server/service/route/Route.dhall rename to dhall/server/service/Route.dhall diff --git a/dhall/server/service/Service.dhall b/dhall/server/service/Service.dhall index f238553..7fb1ef4 100644 --- a/dhall/server/service/Service.dhall +++ b/dhall/server/service/Service.dhall @@ -1,5 +1,5 @@ - let Plugin = ./plugin/Plugin.dhall +let Plugin = ./plugin/Plugin.dhall -in let Route = ./route/Route.dhall +let Route = ./Route.dhall in { name : Text, url : Text, plugins : List Plugin, routes : List Route } diff --git a/dhall/server/service/functions.dhall b/dhall/server/service/functions.dhall deleted file mode 100644 index 08f25c0..0000000 --- a/dhall/server/service/functions.dhall +++ /dev/null @@ -1 +0,0 @@ -{ Plugin = ./plugin/functions.dhall } diff --git a/dhall/server/service/package.dhall b/dhall/server/service/package.dhall new file mode 100644 index 0000000..05bbe37 --- /dev/null +++ b/dhall/server/service/package.dhall @@ -0,0 +1,12 @@ +let Plugin = ./plugin/package.dhall + +let Route = ./Route.dhall + +let Service = + { name : Text + , url : Text + , plugins : List Plugin.Type + , routes : List Route + } + +in { Type = Service, Route = Route, Plugin = Plugin } diff --git a/dhall/server/service/plugin/CorrelationId.dhall b/dhall/server/service/plugin/CorrelationId.dhall deleted file mode 100644 index fc69f4f..0000000 --- a/dhall/server/service/plugin/CorrelationId.dhall +++ /dev/null @@ -1,23 +0,0 @@ -let Plugin = ./Plugin.dhall - -let config = ./Config.dhall - -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 diff --git a/dhall/server/service/plugin/correlationId.dhall b/dhall/server/service/plugin/correlationId.dhall new file mode 100644 index 0000000..d5d5928 --- /dev/null +++ b/dhall/server/service/plugin/correlationId.dhall @@ -0,0 +1,23 @@ +let Plugin = ./Plugin.dhall + +let config = ./Config.dhall + +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 diff --git a/dhall/server/service/plugin/functions.dhall b/dhall/server/service/plugin/functions.dhall deleted file mode 100644 index dcf2c9a..0000000 --- a/dhall/server/service/plugin/functions.dhall +++ /dev/null @@ -1,9 +0,0 @@ -{ mkRequestTermination = - ./mkRequestTermination.dhall -, mkRequestTransformer = - ./mkRequestTransformer.dhall -, mkIPRestriction = - ./mkIPRestriction.dhall -, CorrelationId = - ./CorrelationId.dhall -} diff --git a/dhall/server/service/plugin/package.dhall b/dhall/server/service/plugin/package.dhall new file mode 100644 index 0000000..872c53b --- /dev/null +++ b/dhall/server/service/plugin/package.dhall @@ -0,0 +1,6 @@ +{ Type = ./Plugin.dhall +, mkRequestTermination = ./mkRequestTermination.dhall +, mkRequestTransformer = ./mkRequestTransformer.dhall +, mkIPRestriction = ./mkIPRestriction.dhall +, correlationId = ./correlationId.dhall +} -- 2.41.0