mirror of
https://github.com/spantaleev/matrix-docker-ansible-deploy.git
synced 2025-11-27 03:58:36 +01:00
Add Matrix.to (#4750)
This commit is contained in:
43
roles/custom/matrix-matrixto/tasks/validate_config.yml
Normal file
43
roles/custom/matrix-matrixto/tasks/validate_config.yml
Normal file
@@ -0,0 +1,43 @@
|
||||
# SPDX-FileCopyrightText: 2023 Slavi Pantaleev
|
||||
# SPDX-FileCopyrightText: 2025 Suguru Hirahara
|
||||
#
|
||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
---
|
||||
- name: Fail if required Matrix.to settings not defined
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`{{ item }}`).
|
||||
when: "lookup('vars', item, default='') | string | length == 0"
|
||||
with_items:
|
||||
- matrix_matrixto_hostname
|
||||
- matrix_matrixto_path_prefix
|
||||
- matrix_matrixto_container_network
|
||||
|
||||
- name: Run if Traefik is enabled
|
||||
when: matrix_matrixto_container_labels_traefik_enabled | bool
|
||||
block:
|
||||
- name: Fail if Traefik settings required for Matrix.to are not defined
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
You need to define a required configuration setting (`{{ item }}`).
|
||||
when: "lookup('vars', item, default='') | string | length == 0"
|
||||
with_items:
|
||||
- matrix_matrixto_container_labels_traefik_hostname
|
||||
- matrix_matrixto_container_labels_traefik_path_prefix
|
||||
|
||||
- name: Fail if matrix_matrixto_container_labels_traefik_path_prefix is different than /
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
matrix_matrixto_container_labels_traefik_path_prefix (`{{ matrix_matrixto_container_labels_traefik_path_prefix }}`) must be `/`.
|
||||
Matrix.to does not support hosting under a subpath yet.
|
||||
when: "matrix_matrixto_container_labels_traefik_path_prefix != '/'"
|
||||
|
||||
# We ensure it doesn't end with a slash, because we handle both (slash and no-slash).
|
||||
# Knowing that `matrix_matrixto_container_labels_traefik_path_prefix` does not end with a slash
|
||||
# ensures we know how to set these routes up without having to do "does it end with a slash" checks elsewhere.
|
||||
- name: Fail if matrix_matrixto_container_labels_traefik_path_prefix ends with a slash
|
||||
ansible.builtin.fail:
|
||||
msg: >-
|
||||
matrix_matrixto_container_labels_traefik_path_prefix (`{{ matrix_matrixto_container_labels_traefik_path_prefix }}`) must either be `/` or not end with a slash (e.g. `/matrixto`).
|
||||
when: "matrix_matrixto_container_labels_traefik_path_prefix != '/' and matrix_matrixto_container_labels_traefik_path_prefix[-1] == '/'"
|
||||
Reference in New Issue
Block a user