From 4d19211ce62a7405e4992e54f83851d32f742837 Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Mon, 1 Jul 2019 14:55:17 +0200 Subject: remove org_id from vault type, add sshKey in vault --- dhall/Vault.dhall | 2 +- dhall/mkConfig.dhall | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/dhall/Vault.dhall b/dhall/Vault.dhall index ba1a309..b2a45cc 100644 --- a/dhall/Vault.dhall +++ b/dhall/Vault.dhall @@ -1 +1 @@ -{ organization : Text, secret : Text, token : Text } +{ token : Text, secret : Text, sshKey : Text } diff --git a/dhall/mkConfig.dhall b/dhall/mkConfig.dhall index cf64bef..bd382de 100644 --- a/dhall/mkConfig.dhall +++ b/dhall/mkConfig.dhall @@ -1,17 +1,18 @@ let Config = ./Config.dhall in let Vault = ./Vault.dhall - + in let Addon = ./addon/Addon.dhall - + in let Environment = ./environment/Environment.dhall - + in let nonifyEmpty = λ(opt : Optional Text) → Optional/fold Text opt Text (λ(x : Text) → x) "None" - + in λ(vault : Vault) → λ(app : Text) + → λ(organization : Text) → λ(entryPoint : Optional Text) → λ(metrics : Bool) → λ(syslogServer : Optional Text) @@ -21,7 +22,7 @@ in let Vault = ./Vault.dhall → { clever_app = app , clever_orga = - vault.organization + organization , clever_secret = vault.secret , clever_token = @@ -41,4 +42,4 @@ in let Vault = ./Vault.dhall , clever_env = { FORCE_HTTPS = True } } - : Config Environment \ No newline at end of file + : Config Environment -- cgit v1.2.3 From a8c060229d00306720778c05fe5f53319a8de762 Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Mon, 1 Jul 2019 15:46:31 +0200 Subject: Remove default environment from Dhall config --- dhall/environment/Environment.dhall | 1 - dhall/mkConfig.dhall | 84 ++++++++++++++++++------------------- dhall/types.dhall | 10 +---- 3 files changed, 42 insertions(+), 53 deletions(-) delete mode 100644 dhall/environment/Environment.dhall diff --git a/dhall/environment/Environment.dhall b/dhall/environment/Environment.dhall deleted file mode 100644 index 68514c9..0000000 --- a/dhall/environment/Environment.dhall +++ /dev/null @@ -1 +0,0 @@ -{ FORCE_HTTPS : Bool } diff --git a/dhall/mkConfig.dhall b/dhall/mkConfig.dhall index bd382de..37b029a 100644 --- a/dhall/mkConfig.dhall +++ b/dhall/mkConfig.dhall @@ -1,45 +1,43 @@ let Config = ./Config.dhall -in let Vault = ./Vault.dhall - - in let Addon = ./addon/Addon.dhall - - in let Environment = ./environment/Environment.dhall - - in let nonifyEmpty = - λ(opt : Optional Text) - → Optional/fold Text opt Text (λ(x : Text) → x) "None" - - in λ(vault : Vault) - → λ(app : Text) - → λ(organization : Text) - → λ(entryPoint : Optional Text) - → λ(metrics : Bool) - → λ(syslogServer : Optional Text) - → λ(domain : Optional Text) - → λ(tasksFile : Optional Text) - → λ(addons : List Addon) - → { clever_app = - app - , clever_orga = - organization - , clever_secret = - vault.secret - , clever_token = - vault.token - , clever_syslog_server = - nonifyEmpty syslogServer - , clever_domain = - nonifyEmpty domain - , clever_app_tasks_file = - nonifyEmpty tasksFile - , clever_haskell_entry_point = - nonifyEmpty entryPoint - , clever_metrics = - metrics - , clever_addons = - addons - , clever_env = - { FORCE_HTTPS = True } - } - : Config Environment +let Vault = ./Vault.dhall + +let Addon = ./addon/Addon.dhall + +let nonifyEmpty = + λ(opt : Optional Text) + → Optional/fold Text opt Text (λ(x : Text) → x) "None" + +in λ(vault : Vault) + → λ(app : Text) + → λ(organization : Text) + → λ(entryPoint : Optional Text) + → λ(metrics : Bool) + → λ(syslogServer : Optional Text) + → λ(domain : Optional Text) + → λ(tasksFile : Optional Text) + → λ(addons : List Addon) + → { clever_app = + app + , clever_orga = + organization + , clever_secret = + vault.secret + , clever_token = + vault.token + , clever_syslog_server = + nonifyEmpty syslogServer + , clever_domain = + nonifyEmpty domain + , clever_app_tasks_file = + nonifyEmpty tasksFile + , clever_haskell_entry_point = + nonifyEmpty entryPoint + , clever_metrics = + metrics + , clever_addons = + addons + , clever_env = + {=} + } + : Config {} diff --git a/dhall/types.dhall b/dhall/types.dhall index 5e6a81c..ab153d2 100644 --- a/dhall/types.dhall +++ b/dhall/types.dhall @@ -1,9 +1 @@ -{ Vault = - ./Vault.dhall -, Addon = - ./addon/Addon.dhall -, Environment = - ./environment/Environment.dhall -, Config = - ./Config.dhall -} +{ Vault = ./Vault.dhall, Addon = ./addon/Addon.dhall, Config = ./Config.dhall } -- cgit v1.2.3 From 175b14951e46b4d980839fd719b8b7a64968c073 Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Mon, 1 Jul 2019 16:32:58 +0200 Subject: dhall: expose optional fields as optional values Instead of `nonifying` them --- dhall/Config.dhall | 10 +++++----- dhall/mkConfig.dhall | 12 ++++-------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/dhall/Config.dhall b/dhall/Config.dhall index db063b7..c095403 100644 --- a/dhall/Config.dhall +++ b/dhall/Config.dhall @@ -10,17 +10,17 @@ in λ(Environment : Type) , clever_token : Text , clever_syslog_server : - Text + Optional Text , clever_domain : - Text + Optional Text , clever_app_tasks_file : - Text + Optional Text , clever_haskell_entry_point : - Text + Optional Text , clever_metrics : Bool , clever_addons : List Addon , clever_env : Environment - } \ No newline at end of file + } diff --git a/dhall/mkConfig.dhall b/dhall/mkConfig.dhall index 37b029a..ae84b21 100644 --- a/dhall/mkConfig.dhall +++ b/dhall/mkConfig.dhall @@ -4,10 +4,6 @@ let Vault = ./Vault.dhall let Addon = ./addon/Addon.dhall -let nonifyEmpty = - λ(opt : Optional Text) - → Optional/fold Text opt Text (λ(x : Text) → x) "None" - in λ(vault : Vault) → λ(app : Text) → λ(organization : Text) @@ -26,13 +22,13 @@ in λ(vault : Vault) , clever_token = vault.token , clever_syslog_server = - nonifyEmpty syslogServer + syslogServer , clever_domain = - nonifyEmpty domain + domain , clever_app_tasks_file = - nonifyEmpty tasksFile + tasksFile , clever_haskell_entry_point = - nonifyEmpty entryPoint + entryPoint , clever_metrics = metrics , clever_addons = -- cgit v1.2.3 From 7b4cc6d8d6f2a4e327111d78b0ef1973faf892c1 Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Mon, 1 Jul 2019 16:35:23 +0200 Subject: dhall: remove optional arguments from mkConfig It was just constructing a record without adding any information. Now it constructs a record from its mandatory parts. The caller can then override fields as they please. --- dhall/mkConfig.dhall | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/dhall/mkConfig.dhall b/dhall/mkConfig.dhall index ae84b21..413ea5a 100644 --- a/dhall/mkConfig.dhall +++ b/dhall/mkConfig.dhall @@ -7,12 +7,6 @@ let Addon = ./addon/Addon.dhall in λ(vault : Vault) → λ(app : Text) → λ(organization : Text) - → λ(entryPoint : Optional Text) - → λ(metrics : Bool) - → λ(syslogServer : Optional Text) - → λ(domain : Optional Text) - → λ(tasksFile : Optional Text) - → λ(addons : List Addon) → { clever_app = app , clever_orga = @@ -22,17 +16,17 @@ in λ(vault : Vault) , clever_token = vault.token , clever_syslog_server = - syslogServer + None Text , clever_domain = - domain + None Text , clever_app_tasks_file = - tasksFile + None Text , clever_haskell_entry_point = - entryPoint + None Text , clever_metrics = - metrics + True , clever_addons = - addons + [] : List Addon , clever_env = {=} } -- cgit v1.2.3