install:
# Install ansible
- nix-env -i python2.7-ansible python2.7-ansible-lint
+ - nix-env -if ./dhall-1.18.0.nix
# Check ansible version
- ansible --version
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
- ansible-lint .
- ansible-playbook tests/test.yml -i tests/inventory -C -D
+ - scripts/dhall_check.sh
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
--- /dev/null
+{ pkgs ? import <nixpkgs> {} }: with pkgs;
+
+stdenv.mkDerivation rec {
+ name = "dhall-${version}";
+ version = "1.18.0";
+ phases = [ "installPhase "];
+ src = fetchurl {
+ url = "https://github.com/dhall-lang/dhall-haskell/releases/download/${version}/dhall-${version}-x86_64-linux.tar.bz2";
+ sha256 = "0jvw6ss96xifb21mzpvfjzvaffcnpj0jhpc4rd36cl2r22800qgx";
+ };
+ installPhase = ''
+ mkdir -p $out/bin
+ tar -xjf $src
+ mv bin/dhall $out/bin/
+ '';
+}
--- /dev/null
+let Server = ./server/Server.dhall in { kong_servers : List Server }
--- /dev/null
+{ appAdminApiKey : Text, accessKey : Text }
--- /dev/null
+{ Server = ./server/functions.dhall }
--- /dev/null
+ let Service = ./service/Service.dhall
+
+in { kong_app_admin_url :
+ Text
+ , kong_app_admin_apikey :
+ Text
+ , services :
+ List Service
+ }
--- /dev/null
+{ Service = ./service/functions.dhall, mkServer = ./mkServer.dhall }
--- /dev/null
+ 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
--- /dev/null
+ let Plugin = ./plugin/Plugin.dhall
+
+in let Route = ./route/Route.dhall
+
+in { name : Text, url : Text, plugins : List Plugin, routes : List Route }
--- /dev/null
+{ Plugin = ./plugin/functions.dhall }
--- /dev/null
+< CorrelationId :
+ { header_name : Text, echo_downstream : Bool }
+| RequestTransformer :
+ { `add.headers` : Text }
+| RequestTermination :
+ { status_code : Natural, content_type : Text, body : Text }
+| IPRestriction :
+ { whitelist : Text }
+>
--- /dev/null
+ let Plugin = ./Plugin.dhall
+
+in let config = constructors ./Config.dhall
+
+in { name =
+ "correlation-id"
+ , config =
+ config.CorrelationId
+ { header_name = "X-correl", echo_downstream = True }
+ }
+ : Plugin
--- /dev/null
+let Config = ./Config.dhall in { name : Text, config : Config }
--- /dev/null
+{ mkRequestTermination =
+ ./mkRequestTermination.dhall
+, mkRequestTransformer =
+ ./mkRequestTransformer.dhall
+, mkIPRestriction =
+ ./mkIPRestriction.dhall
+, CorrelationId =
+ ./CorrelationId.dhall
+}
--- /dev/null
+ let Plugin = ./Plugin.dhall
+
+in let config = constructors ./Config.dhall
+
+in λ(whiteList : Text)
+ → { name =
+ "ip-restriction"
+ , config =
+ config.IPRestriction { whitelist = whiteList }
+ }
+ : Plugin
--- /dev/null
+ let Plugin = ./Plugin.dhall
+
+in let config = constructors ./Config.dhall
+
+in λ(statusCode : Natural)
+ → λ(contentType : Text)
+ → λ(body : Text)
+ → { name =
+ "request-termination"
+ , config =
+ config.RequestTermination
+ { status_code =
+ statusCode
+ , content_type =
+ contentType
+ , body =
+ body
+ }
+ }
+ : Plugin
--- /dev/null
+ let Plugin = ./Plugin.dhall
+
+in let config = constructors ./Config.dhall
+
+in λ(header : Text)
+ → { name =
+ "request-transformer"
+ , config =
+ config.RequestTransformer { `add.headers` = header }
+ }
+ : Plugin
--- /dev/null
+{ paths : List Text, protocols : List Text, hosts : List Text }
--- /dev/null
+{ Vault =
+ ./Vault.dhall
+, Config =
+ ./Config.dhall
+, Server =
+ ./server/Server.dhall
+, Service =
+ ./server/service/Service.dhall
+, Plugin =
+ ./server/service/plugin/Plugin.dhall
+, Route =
+ ./server/service/route/Route.dhall
+}
--- /dev/null
+#!/usr/bin/env bash
+
+pushd () {
+ command pushd "$@" > /dev/null
+}
+
+popd () {
+ command popd "$@" > /dev/null
+}
+
+go() {
+ local ERROR=0;
+ for file in $(find -type f -name "*.dhall"); do
+ pushd $(dirname $file);
+ cat $(basename $file) | dhall --explain resolve > /dev/null;
+ echo "Type checking ${file}"
+ if [ "$?" -ne "0" ]; then
+ echo "Failed to resolve $file"
+ ERROR=1;
+ fi;
+ popd;
+ done;
+ exit $ERROR;
+}
+
+go