Commit 725f3cef authored by Łukasz Nowak's avatar Łukasz Nowak

caddy-frontend: Allow to override parameters

As there is some kind of "collision" with request, allow to override
parameters.

Treat `<key>` as default and overwrite it with `frontend-config-<num>-<key>`,
instead of having the global `<key>` always passed to slaves.

This allows to request the partition with:

  monitor-httpd-frontend=12345
  -frontend-config-1-monitor-httpd-frontend=9876
  -frontend-config-1-monitor-httpd-frontend=8765
parent 762ab365
...@@ -22,7 +22,7 @@ md5sum = 2db996d2c48c0fe03c05f051e7a914bc ...@@ -22,7 +22,7 @@ md5sum = 2db996d2c48c0fe03c05f051e7a914bc
[template-apache-replicate] [template-apache-replicate]
filename = instance-apache-replicate.cfg.in filename = instance-apache-replicate.cfg.in
md5sum = a30d4bc21ae94d0eca42cea5032468a8 md5sum = a757e014f362c3db3c2717cc5b4102ab
[template-slave-list] [template-slave-list]
filename = templates/apache-custom-slave-list.cfg.in filename = templates/apache-custom-slave-list.cfg.in
......
...@@ -100,8 +100,8 @@ name = {{ frontend_request.get('name') }} ...@@ -100,8 +100,8 @@ name = {{ frontend_request.get('name') }}
{% if frontend_request.get('state') %} {% if frontend_request.get('state') %}
state = {{ frontend_request.get('state') }} state = {{ frontend_request.get('state') }}
{% endif%} {% endif%}
{% set slave_configuration_dict = frontend_request.get('config') %} {% set slave_configuration_dict = slapparameter_dict %}
{% do slave_configuration_dict.update(**slapparameter_dict) %} {% do slave_configuration_dict.update(frontend_request.get('config')) %}
{% do slave_configuration_dict.__setitem__(slave_list_name, json_module.dumps(authorized_slave_list)) %} {% do slave_configuration_dict.__setitem__(slave_list_name, json_module.dumps(authorized_slave_list)) %}
{% do slave_configuration_dict.__setitem__("frontend-name", frontend_request.get('name')) %} {% do slave_configuration_dict.__setitem__("frontend-name", frontend_request.get('name')) %}
config-_ = {{ json_module.dumps(slave_configuration_dict) }} config-_ = {{ json_module.dumps(slave_configuration_dict) }}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment