1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-04 10:24:41 +02:00
Mailu/setup
2023-10-31 10:25:28 +00:00
..
flavors/compose Fixed log filter not filtering out log messages for dovecot/nginx/postfix. 2023-10-27 14:10:13 +00:00
static Added checks to SETUP to make sure JavaScript is enabled and that all JS files could be loaded when loading the site page. 2023-10-29 12:55:40 +00:00
templates Check IPv4 and subnet server side, flash message if these are invalid. 2023-10-31 09:54:13 +00:00
.env Revert accidental setup commits and fix code/pre tags 2019-01-28 20:23:41 +01:00
docker-compose.yml Revert accidental setup commits and fix code/pre tags 2019-01-28 20:23:41 +01:00
Dockerfile Added checks to SETUP to make sure JavaScript is enabled and that all JS files could be loaded when loading the site page. 2023-10-29 12:55:40 +00:00
main.py
README.md Fix a bunch of typos 2022-10-19 19:41:49 +02:00
server.py Also check server-side subnet6 and bind6 2023-10-31 10:25:28 +00:00

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>