diff options
-rw-r--r-- | defaults/main.yml | 1 | ||||
-rw-r--r-- | tasks/environment.yml | 10 | ||||
-rw-r--r-- | templates/env.j2 | 9 |
3 files changed, 12 insertions, 8 deletions
diff --git a/defaults/main.yml b/defaults/main.yml index dcf9650..bd3b6a6 100644 --- a/defaults/main.yml +++ b/defaults/main.yml | |||
@@ -7,6 +7,7 @@ clever_app_confdir: "{{ clever_app_root }}/.clever_cloud" | |||
7 | clever_login_file: "{{ clever_app_confdir }}/login" | 7 | clever_login_file: "{{ clever_app_confdir }}/login" |
8 | 8 | ||
9 | clever_haskell_entry_point: "{{ clever_entry_point | default(None) }}" | 9 | clever_haskell_entry_point: "{{ clever_entry_point | default(None) }}" |
10 | clever_haskell_env: {} | ||
10 | clever_env: {} | 11 | clever_env: {} |
11 | 12 | ||
12 | clever_disable_metrics: false | 13 | clever_disable_metrics: false |
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 @@ | |||
1 | - name: Setup haskell-specific environment variables | ||
2 | set_fact: | ||
3 | clever_haskell_env: | ||
4 | CC_RUN_COMMAND: "~/.local/bin/{{ clever_haskell_entry_point }}" | ||
5 | when: clever_haskell_entry_point is defined | ||
6 | |||
7 | - name: Assemble full environment | ||
8 | set_fact: | ||
9 | clever_env: "{{ clever_base_env | combine(clever_haskell_env) | combine(clever_env) }}" | ||
10 | |||
1 | - name: Create environment file | 11 | - name: Create environment file |
2 | template: | 12 | template: |
3 | src: env.j2 | 13 | src: env.j2 |
diff --git a/templates/env.j2 b/templates/env.j2 index e97ef43..59f3050 100644 --- a/templates/env.j2 +++ b/templates/env.j2 | |||
@@ -1,10 +1,3 @@ | |||
1 | {% set static_env = clever_base_env | combine(clever_env) %} | ||
2 | {% set dynamic_env = {} %} | ||
3 | {% if clever_haskell_entry_point %} | ||
4 | {# Haskell only #} | ||
5 | {# https://www.clever-cloud.com/doc/get-help/reference-environment-variables/#haskell #} | ||
6 | {% set dynamic_env = { 'CC_RUN_COMMAND': '~/.local/bin/' + clever_haskell_entry_point } %} | ||
7 | {% endif %} | ||
8 | {# dict2items is not enough here, all the values have to be stringified #} | 1 | {# dict2items is not enough here, all the values have to be stringified #} |
9 | {# git-blame this line for more explanations #} | 2 | {# git-blame this line for more explanations #} |
10 | {{ static_env | combine(dynamic_env) | json_env_map | to_json }} | 3 | {{ clever_env | json_env_map | to_json }} |