Skip to content

Commit 407b470

Browse files
committed
Use ota_apps_config variables only in the playbook
1 parent 6d80206 commit 407b470

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

playbooks/deploy.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@
2222
(ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.type is defined and ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.type == 'mongo')
2323
) | bool
2424
}}"
25+
2526
snapshots_repository: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.repository is defined and ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.repository }}"
2627
snapshots_path: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.path is defined and ota_apps_config['@opentermsarchive/engine'].recorder.snapshots.storage.git.path }}"
28+
2729
versions_repository: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.repository is defined and ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.repository }}"
2830
versions_path: "{{ ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.path is defined and ota_apps_config['@opentermsarchive/engine'].recorder.versions.storage.git.path }}"
31+
32+
collection_api_basePath: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath is defined and ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath }}"
33+
collection_api_port: "{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].port is defined and ota_apps_config['@opentermsarchive/engine']['collection-api'].port }}"
34+
35+
federation_api_basePath: "{{ ota_apps_config['@opentermsarchive/federation-api'].basePath is defined and ota_apps_config['@opentermsarchive/federation-api'].basePath }}"
36+
federation_api_port: "{{ ota_apps_config['@opentermsarchive/federation-api'].port is defined and ota_apps_config['@opentermsarchive/federation-api'].port }}"
2937

3038
- name: Install infrastructure
3139
become: true

playbooks/templates/nginx-reverse-proxy-conf.j2

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,20 @@ server {
44
listen 80;
55
server_name {{ inventory_hostname }};
66

7-
{% if ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath is defined and ota_apps_config['@opentermsarchive/engine']['collection-api'].port is defined %}
8-
location {{ ota_apps_config['@opentermsarchive/engine']['collection-api'].basePath }} {
7+
{% if collection_api_basePath and collection_api_port %}
8+
location {{ collection_api_basePath }} {
99
# Allowing for a `burst` of up to 5 requests beyond the specified rate limit. The `nodelay` parameter ensures that excessive requests beyond the burst limit are immediately rejected with a 429 error response instead of being queued. See https://www.nginx.com/blog/rate-limiting-nginx/.
1010
limit_req zone=limited burst=5 nodelay;
11-
proxy_pass http://localhost:{{ ota_apps_config['@opentermsarchive/engine']['collection-api'].port }};
11+
proxy_pass http://localhost:{{ collection_api_port }};
1212
proxy_redirect off;
1313
}
1414
{% endif %}
1515

16-
{% if ota_apps_config['@opentermsarchive/federation-api'].basePath is defined and ota_apps_config['@opentermsarchive/federation-api'].port is defined %}
17-
location {{ ota_apps_config['@opentermsarchive/federation-api'].basePath }} {
16+
{% if federation_api_basePath and federation_api_port %}
17+
location {{ federation_api_basePath }} {
1818
# Allowing for a `burst` of up to 5 requests beyond the specified rate limit. The `nodelay` parameter ensures that excessive requests beyond the burst limit are immediately rejected with a 429 error response instead of being queued. See https://www.nginx.com/blog/rate-limiting-nginx/.
1919
limit_req zone=limited burst=5 nodelay;
20-
proxy_pass http://localhost:{{ ota_apps_config['@opentermsarchive/federation-api'].port }};
20+
proxy_pass http://localhost:{{ federation_api_port }};
2121
proxy_redirect off;
2222
}
2323
{% endif %}

0 commit comments

Comments
 (0)