1
0
mirror of https://github.com/Mailu/Mailu.git synced 2024-12-04 10:24:41 +02:00
Mailu/setup
bors[bot] d0d4876a85
Merge #2982
2982: Switch to upstream's clamav image r=mergify[bot] a=nextgens

## What type of PR?

enhancement

## What does this PR do?

Switch to upstream's clamav image. The only downside is that it doesn't support armv7... but odds are it won't have enough RAM anyway.

Why do we want this?
- faster build times
- will be easier to upgrade
- less maintenance required for us
- it may fix the CI tests failing because of clamav/EICAR not getting caught
- it will save bandwidth (as we won't re-download the definitions from fresh: they are in the base image)
- it puts clamav on its own network (security)

### Related issue(s)
- close #2059

## 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.

- [ ] 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: Florent Daigniere <nextgens@freenetproject.org>
2023-10-17 09:41:49 +00:00
..
flavors/compose Merge #2982 2023-10-17 09:41:49 +00:00
static Use server-side password generator for generating token. 2023-01-31 12:37:25 +00:00
templates Review 2023-10-12 20:42:16 +02: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 Move it to base since admin will also use it 2022-11-17 15:17:24 +01:00
main.py Rename the config dir to setup 2018-04-22 16:10:25 +02:00
README.md Fix a bunch of typos 2022-10-19 19:41:49 +02:00
server.py Re-add flavor and steps to wizard. 2022-11-25 08:29:50 +01: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>