Verified Commit a841a2c5 authored by Jan Alexander Steffens (heftig)'s avatar Jan Alexander Steffens (heftig)
Browse files

matrix: Avoid using maps of maps with free keys

Prefer using lists of maps with consistent keys.
parent ccf39d78
This diff is collapsed.
--- ---
matrix_nginx_config: matrix_nginx_config:
federation_reader: - name: federation_reader
port: 8011 port: 8011
locations: locations:
- "~ ^/_matrix/federation/v1/event/" - "~ ^/_matrix/federation/v1/event/"
...@@ -26,7 +26,7 @@ matrix_nginx_config: ...@@ -26,7 +26,7 @@ matrix_nginx_config:
- "~ ^/_matrix/federation/v1/get_groups_publicised$" - "~ ^/_matrix/federation/v1/get_groups_publicised$"
- "~ ^/_matrix/key/v2/query" - "~ ^/_matrix/key/v2/query"
- "~ ^/_matrix/federation/v1/send/" # Don't load balance - "~ ^/_matrix/federation/v1/send/" # Don't load balance
media_repository: - name: media_repository
port: 8013 port: 8013
locations: locations:
- "~ ^/_matrix/media/" - "~ ^/_matrix/media/"
...@@ -35,7 +35,7 @@ matrix_nginx_config: ...@@ -35,7 +35,7 @@ matrix_nginx_config:
- "~ ^/_synapse/admin/v1/user/.*/media.*$" - "~ ^/_synapse/admin/v1/user/.*/media.*$"
- "~ ^/_synapse/admin/v1/media/.*$" - "~ ^/_synapse/admin/v1/media/.*$"
- "~ ^/_synapse/admin/v1/quarantine_media/.*$" - "~ ^/_synapse/admin/v1/quarantine_media/.*$"
homeserver: - name: homeserver
port: 8008 port: 8008
locations: locations:
- "/_matrix" - "/_matrix"
......
...@@ -4,20 +4,20 @@ as_token: {{ vault_matrix_secrets.irc_as_token }} ...@@ -4,20 +4,20 @@ as_token: {{ vault_matrix_secrets.irc_as_token }}
namespaces: namespaces:
users: users:
{% for network in vault_matrix_secrets.irc_networks.values() %} {% for network in vault_matrix_secrets.irc_networks %}
- exclusive: true - exclusive: true
regex: '@{{ network.name | regex_escape() }}_.*:{{ matrix_server_name | regex_escape() }}' regex: '@{{ network.name | regex_escape() }}_.*:{{ matrix_server_name | regex_escape() }}'
group_id: '+{{ network.name }}:{{ matrix_server_name }}' group_id: '+{{ network.name }}:{{ matrix_server_name }}'
{% endfor %} {% endfor %}
aliases: aliases:
{% for network in vault_matrix_secrets.irc_networks.values() %} {% for network in vault_matrix_secrets.irc_networks %}
- exclusive: true - exclusive: true
regex: '#{{ network.name | regex_escape() }}_.*:{{ matrix_server_name | regex_escape() }}' regex: '#{{ network.name | regex_escape() }}_.*:{{ matrix_server_name | regex_escape() }}'
{% endfor %} {% endfor %}
rooms: rooms:
{% for room in vault_matrix_secrets | json_query("irc_networks.*[].mappings.*[].room") %} {% for room in vault_matrix_secrets | json_query("irc_networks[].mappings[].room") %}
- exclusive: false - exclusive: false
regex: '{{ room | regex_escape() }}' regex: '{{ room | regex_escape() }}'
{% endfor %} {% endfor %}
......
...@@ -43,9 +43,9 @@ homeserver: ...@@ -43,9 +43,9 @@ homeserver:
# Configuration specific to the IRC service # Configuration specific to the IRC service
ircService: ircService:
servers: servers:
{% for address, network in vault_matrix_secrets.irc_networks.items() %} {% for network in vault_matrix_secrets.irc_networks %}
# The address of the server to connect to. # The address of the server to connect to.
"{{ address }}": "{{ network.address }}":
# A human-readable short name. This is used to label IRC status rooms # A human-readable short name. This is used to label IRC status rooms
# where matrix users control their connections. # where matrix users control their connections.
# E.g. 'ExampleNet IRC Bridge status'. # E.g. 'ExampleNet IRC Bridge status'.
...@@ -270,8 +270,8 @@ ircService: ...@@ -270,8 +270,8 @@ ircService:
# 1:many mappings from IRC channels to room IDs on this IRC server. # 1:many mappings from IRC channels to room IDs on this IRC server.
# The matrix room must already exist. Your matrix client should expose # The matrix room must already exist. Your matrix client should expose
# the room ID in a "settings" page for the room. # the room ID in a "settings" page for the room.
{% for channel, mapping in network.mappings.items() %} {% for mapping in network.mappings %}
"{{ channel }}": "{{ mapping.channel }}":
roomIds: ["{{ mapping.room }}"] roomIds: ["{{ mapping.room }}"]
key: "{{ mapping.key }}" key: "{{ mapping.key }}"
{% endfor %} {% endfor %}
......
{% for name, config in matrix_nginx_config.items() %} {% for config in matrix_nginx_config %}
upstream matrix_{{ name }} { upstream matrix_{{ config.name }} {
server 127.0.0.1:{{ config.port }}; server 127.0.0.1:{{ config.port }};
} }
...@@ -32,12 +32,12 @@ server { ...@@ -32,12 +32,12 @@ server {
ssl_certificate_key /etc/letsencrypt/live/{{ matrix_domain }}/privkey.pem; ssl_certificate_key /etc/letsencrypt/live/{{ matrix_domain }}/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/{{ matrix_domain }}/chain.pem; ssl_trusted_certificate /etc/letsencrypt/live/{{ matrix_domain }}/chain.pem;
{% for name, config in matrix_nginx_config.items() %} {% for config in matrix_nginx_config %}
# {{ name }} # {{ config.name }}
{% for location in config.locations %} {% for location in config.locations %}
location {{ location }} { location {{ location }} {
access_log /var/log/nginx/{{ matrix_domain }}/access.log main; access_log /var/log/nginx/{{ matrix_domain }}/access.log main;
proxy_pass http://matrix_{{ name }}; proxy_pass http://matrix_{{ config.name }};
proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-For $remote_addr;
proxy_read_timeout 900s; proxy_read_timeout 900s;
} }
......
Supports Markdown
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