ansible-ffibk/roles/pdns-admin/templates/config.py.j2

53 lines
1.5 KiB
Text
Raw Normal View History

import os
basedir = os.path.abspath(os.path.dirname(__file__))
{% if pdns_admin_global_config is defined %}
{% for key, value in pdns_admin_global_config.items() %}
{% if key | upper not in ["UPLOAD_DIR"] %}
{% if value is not mapping %}
{% if value is sequence and value is not string %}
{% if value[0] is number %}
{{ key | upper }} = [ {{ value|join(', ') }} ]
{% else %}
{{ key | upper }} = [ "{{ value|join('", "') }}" ]
{% endif %}
{% else %}
{% if value == "true" or value == "false" or value is number %}
{{ key | upper }} = {{ value }}
{% else %}
{{ key | upper }} = "{{ value }}"
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
# Upload
UPLOAD_DIR = os.path.join(basedir, 'upload')
{% endif %}
{% if pdns_admin_database_config is defined %}
{% for key, value in pdns_admin_database_config.items() %}
{% if key | upper not in ["SQLALCHEMY_DATABASE_URI", "SQLALCHEMY_MIGRATE_REPO"] %}
{% if value is not mapping %}
{% if value is sequence and value is not string %}
{% if value[0] is number %}
{{ key | upper }} = [ {{ value|join(', ') }} ]
{% else %}
{{ key | upper }} = [ "{{ value|join('", "') }}" ]
{% endif %}
{% else %}
{% if value == "true" or value == "false" or value is number %}
{{ key | upper }} = {{ value }}
{% else %}
{{ key | upper }} = "{{ value }}"
{% endif %}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
SQLALCHEMY_DATABASE_URI = 'mysql://'+SQLA_DB_USER+':'\
+SQLA_DB_PASSWORD+'@'+SQLA_DB_HOST+'/'+SQLA_DB_NAME
{% endif %}
SAML_ENABLED = False