Browse Source

it's just toml bro

master
Sean Johnson 5 months ago
parent
commit
5822438cd9
  1. 10
      app/oauth2_proxy/init.sls
  2. 18
      app/oauth2_proxy/templates/config.j2

10
app/oauth2_proxy/init.sls

@ -5,12 +5,12 @@ @@ -5,12 +5,12 @@
{% set config_file = settings.conf_dir | path_join("settings.cfg") %}
{{ config_file }}:
file.managed:
- source: salt://app/oauth2_proxy/templates/config.j2
file.serialize:
- formatter: toml
- dataset: {{ settings | tojson }}
- makedirs: true
- template: jinja
- context:
config: {{ settings | tojson }}
- user: root
- group: root
- mode: 0640
oauth2-proxy image:

18
app/oauth2_proxy/templates/config.j2

@ -1,18 +0,0 @@ @@ -1,18 +0,0 @@
{% macro config_item(key, value) %}
{% if value is string %}
{{ key }} = {{ value|yaml_dquote }}
{% elif value is boolean %}
{{ key }} = {{ value|string|lower }}
{% elif value|is_list %}
{{ key }} = [
{% for item in value %} "{{ value }}",
{% endfor %}
]
{% else %}
{{ raise("config item "~key~" has unhandlable value: "~value) }}
{% endif %}
{% endmacro %}
{% for key, value in config.items() %}
{{ config_item(key, value) }}
{% endfor %}
Loading…
Cancel
Save