From 244339e70a1be830ac02306e1feb4383fe73572b Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Thu, 18 Jun 2020 16:09:46 +0200 Subject: Use JSON import for environment variables The env can be provided as a JSON list `[{"name": "PORT", "value": "8080"}]`. The `dict2items` filter provided by ansible is _almost_ what we want, but it keeps the value original types (a boolean is kept as a boolean in the JSON value). Since environment variables are strings and `clever-tools` does not want to make the implicit coercion for us, we need to do it ourselves. --- tasks/deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tasks') diff --git a/tasks/deploy.yml b/tasks/deploy.yml index 4d4ecaa..751d78f 100644 --- a/tasks/deploy.yml +++ b/tasks/deploy.yml @@ -17,7 +17,7 @@ CONFIGURATION_FILE: "{{ clever_login_file }}" - name: Push Environment - shell: "clever env import < {{ clever_app_confdir }}/env" + shell: "clever env import --json < {{ clever_app_confdir }}/env" args: chdir: "{{ clever_app_root }}" environment: -- cgit v1.2.3 From d5b5cb172cd488883e2eac0395dbe4d34ddd7a44 Mon Sep 17 00:00:00 2001 From: Clement Delafargue Date: Fri, 19 Jun 2020 11:10:12 +0200 Subject: Extract environment building tasks from the JSON template --- tasks/environment.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tasks') diff --git a/tasks/environment.yml b/tasks/environment.yml index 1508ad4..60b31d2 100644 --- a/tasks/environment.yml +++ b/tasks/environment.yml @@ -1,3 +1,13 @@ +- name: Setup haskell-specific environment variables + set_fact: + clever_haskell_env: + CC_RUN_COMMAND: "~/.local/bin/{{ clever_haskell_entry_point }}" + when: clever_haskell_entry_point is defined + +- name: Assemble full environment + set_fact: + clever_env: "{{ clever_base_env | combine(clever_haskell_env) | combine(clever_env) }}" + - name: Create environment file template: src: env.j2 -- cgit v1.2.3