You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mailu/setup
bors[bot] c15595836a
Merge #2690
2690: Change rspamd override system to use .include with lowest priority. r=mergify[bot] a=Diman0

## What does this PR do?

All override files are used as if they were placed in the rspamd local.d folder.

New override system for Rspamd. In the old system, all files were placed in the Rspamd overrides folder. These overrides would override everything, including the Mailu Rspamd config.

Now overrides are placed in /overrides.
If you use your own map files, change the location to /override/myMapFile.map in the corresponding conf file. It works as following.
* If the override file overrides a Mailu defined config file, it will be included in the Mailu config file with lowest priority. It will merge with existing sections.
* If the override file does not override a Mailu defined config file, then the file will be placed in the rspamd local.d folder. It will merge with existing sections.

For more information, see the description of the local.d folder on the rspamd website: https://www.rspamd.com/doc/faq.html#what-are-the-locald-and-overrided-directories

## What type of PR?

enhancement

### Related issue(s)
- closes #2555 

## Prerequisites
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [x] In case of feature or enhancement: documentation updated accordingly
- [x] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file.


Co-authored-by: Dimitri Huisman <diman@huisman.xyz>
1 year ago
..
flavors/compose Merge #2690 1 year ago
static Use server-side password generator for generating token. 1 year ago
templates clarify 1 year ago
.env Revert accidental setup commits and fix code/pre tags 6 years ago
Dockerfile Move it to base since admin will also use it 2 years ago
README.md Fix a bunch of typos 2 years ago
docker-compose.yml Revert accidental setup commits and fix code/pre tags 6 years ago
main.py Rename the config dir to setup 6 years ago
server.py Re-add flavor and steps to wizard. 2 years ago

README.md

Adding more flavors/steps

(Everything will go under setup/ directory - using Kubernetes flavor as example)

Until this point, the app is working as it follows:

  • when accessing the setup page it will display the flavors selection step (templates/steps/flavor.html)
  • after you choose your desired flavor it will iterate over the files in the flavor directory and building the page (templates/steps/config.html is general for all flavors)
  • when you complete all required fields and press "Setup Mailu" button it will redirect you to the setup page (flavors/choosen-flavor/setup.html)

To add a new flavor you need to create a directory under templates/steps/ in which you are adding actual steps. Eg: Adding a WIP step we'll create templates/steps/kubernetes/wip.html

Note that wizard.html is iterating over files in this directory and building the page. Files are prefixed with a number for sorting purposes.

wip.html will start with

{% call macros.panel("info", "Step X - Work in progress") %}

and end with

{% endcall %}

You store variable from front-page using the name attribute inside tag. In the example below the string entered in the input field is stored in the variable named var_test

<input type="text" name="var_test">

In order to use the variable further you use it like {{ var_test }}

In the setup page (flavors/kubernetes/setup.html) you can add steps by importing macros

{% import "macros.html" as macros %}

and start and end every step with

{% call macros.panel("info", "Step X - Title") %}
-------------------
{% endcall %}

Generating a file

Create the file template in flavors/kubernetes/ (eg. file.txt) in which you save your variables

ROOT = {{ root }}
MY_VAR = {{ var_test }}

When you submit to Setup Mailu the file will be generated. In order to get the file add the following command to setup.html

<p>curl {{ url_for('.file', uid=uid, filepath='file.txt', _external=True) }} > file.txt</p>