From 25bf64cbc9a8ed4fef36c15756f9d7f8e96e2d06 Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Thu, 3 Oct 2019 11:31:56 +0200 Subject: 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 | 22 ---------------------- dhall-1.26.1.nix | 22 ++++++++++++++++++++++ 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.dhall | 1 + dhall/server/service/Service.dhall | 4 ++-- dhall/server/service/functions.dhall | 1 - dhall/server/service/package.dhall | 12 ++++++++++++ dhall/server/service/plugin/CorrelationId.dhall | 23 ----------------------- dhall/server/service/plugin/correlationId.dhall | 23 +++++++++++++++++++++++ dhall/server/service/plugin/functions.dhall | 9 --------- dhall/server/service/plugin/package.dhall | 6 ++++++ dhall/server/service/route/Route.dhall | 1 - 19 files changed, 95 insertions(+), 87 deletions(-) delete mode 100644 dhall-1.21.0.nix create mode 100644 dhall-1.26.1.nix 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 create mode 100644 dhall/server/service/Route.dhall 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 delete mode 100644 dhall/server/service/route/Route.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.21.0.nix deleted file mode 100644 index e53369b..0000000 --- a/dhall-1.21.0.nix +++ /dev/null @@ -1,22 +0,0 @@ -{ pkgs ? import {} }: with pkgs; - -let - mkVersion = - version: sha256: - stdenv.mkDerivation { - name = "dhall-${version}"; - inherit version; - src = fetchurl { - url = "https://github.com/dhall-lang/dhall-haskell/releases/download/${version}/dhall-${version}-x86_64-linux.tar.bz2"; - inherit sha256; - }; - unpackPhase = '' - tar -xjf $src - ''; - installPhase = '' - mkdir -p $out/bin - mv bin/dhall $out/bin/ - ''; - }; -in - mkVersion "1.21.0" "0x7q6v1y62fq6724kx1hcfp1fcqv3lbv33ji6jzfd5y316a31r77" diff --git a/dhall-1.26.1.nix b/dhall-1.26.1.nix new file mode 100644 index 0000000..918a528 --- /dev/null +++ b/dhall-1.26.1.nix @@ -0,0 +1,22 @@ +{ pkgs ? import {} }: with pkgs; + +let + mkVersion = + version: sha256: + stdenv.mkDerivation { + name = "dhall-${version}"; + inherit version; + src = fetchurl { + url = "https://github.com/dhall-lang/dhall-haskell/releases/download/${version}/dhall-${version}-x86_64-linux.tar.bz2"; + inherit sha256; + }; + unpackPhase = '' + tar -xjf $src + ''; + installPhase = '' + mkdir -p $out/bin + mv bin/dhall $out/bin/ + ''; + }; +in + 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.dhall b/dhall/server/service/Route.dhall new file mode 100644 index 0000000..c0fa1a9 --- /dev/null +++ b/dhall/server/service/Route.dhall @@ -0,0 +1 @@ +{ paths : List Text, protocols : List Text, hosts : List Text } 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 +} diff --git a/dhall/server/service/route/Route.dhall b/dhall/server/service/route/Route.dhall deleted file mode 100644 index c0fa1a9..0000000 --- a/dhall/server/service/route/Route.dhall +++ /dev/null @@ -1 +0,0 @@ -{ paths : List Text, protocols : List Text, hosts : List Text } -- cgit v1.2.3