1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-12 10:45:38 +02:00
Mailu/setup
2021-12-21 14:02:13 +00:00
..
flavors Merge #2035 2021-12-19 16:19:05 +00:00
static Process code review comments (PR #2069). 2021-12-01 20:46:10 +00:00
templates Remove not-used DB_PORT/ROUNDCUBE_DB_PORT environment variables. Document how to specify port for DB URL 2021-12-21 14:02: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 Process code review remarks 2021-11-18 17:21:56 +00:00
main.py Rename the config dir to setup 2018-04-22 16:10:25 +02:00
README.md Remove Mailu PostgreSQL. Make roundcube database configurable via setup. Fix #1838. 2021-12-01 15:59:47 +00:00
requirements.txt Adapt requirements.txt to use pinned versions. 2021-07-22 14:44:30 +00:00
server.py Remove dot in blueprint name to prevent critical flask initialisation error. 2021-07-20 11:22:02 +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 accesing the setup page it will display the flavors selection step (templates/steps/flavor.html)
  • after you choose your desired flavor it will iterare 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 furter 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>