diff --git a/imageroot/actions/configure-module/10configure b/imageroot/actions/configure-module/10configure index 0c9a416..2e14070 100755 --- a/imageroot/actions/configure-module/10configure +++ b/imageroot/actions/configure-module/10configure @@ -25,3 +25,5 @@ providers = agent.list_service_providers(rdb, 'imap', 'tcp', { if providers: # Set the PROVIDER_IP (IPV4) environment variable to the host of the first provider agent.set_env("PROVIDER_IP", providers[0]["host"]) + +agent.set_env("RETENTION_DAYS", data["retention_days"]) diff --git a/imageroot/actions/configure-module/validate-input.json b/imageroot/actions/configure-module/validate-input.json index 830cd34..31f4144 100755 --- a/imageroot/actions/configure-module/validate-input.json +++ b/imageroot/actions/configure-module/validate-input.json @@ -7,7 +7,8 @@ { "host": "piler.nethserver.org", "http2https": true, - "lets_encrypt": true + "lets_encrypt": true, + "retention_days": 365 } ], "type": "object", @@ -15,7 +16,8 @@ "host", "http2https", "lets_encrypt", - "mail_server" + "mail_server", + "retention_days" ], "properties": { "host": { @@ -39,6 +41,12 @@ "description": "Mail server UUID", "type": "string", "title": "Mail server UUID" + }, + "retention_days": { + "description": "Number of days to keep the emails", + "type": "integer", + "minimum": 1, + "title": "Retention days" } } } diff --git a/imageroot/actions/get-configuration/20read b/imageroot/actions/get-configuration/20read index 0f84339..f484271 100755 --- a/imageroot/actions/get-configuration/20read +++ b/imageroot/actions/get-configuration/20read @@ -18,7 +18,7 @@ config["host"] = os.environ.get("TRAEFIK_HOST",'') config["http2https"] = os.environ.get("TRAEFIK_HTTP2HTTPS","False") == "True" config["lets_encrypt"] = os.environ.get("TRAEFIK_LETS_ENCRYPT","False") == "True" config["mail_server"] = os.getenv("MAIL_SERVER", "") - +config['retention_days'] = int(os.getenv("RETENTION_DAYS", 2557)) rdb = agent.redis_connect() # full read-only access on every key modules=[] # we query about all mail server to use it inside the user interface diff --git a/imageroot/actions/get-configuration/validate-output.json b/imageroot/actions/get-configuration/validate-output.json index b22f24e..3b6fced 100644 --- a/imageroot/actions/get-configuration/validate-output.json +++ b/imageroot/actions/get-configuration/validate-output.json @@ -10,7 +10,8 @@ "lets_encrypt": true, "mail_server": "xxxxxxxxxxxxxxxxxxxxxxxxx", "is_default_password_admin": false, - "is_default_password_auditor": false + "is_default_password_auditor": false, + "retention_days": 365 } ], "type": "object", @@ -20,7 +21,8 @@ "lets_encrypt", "mail_server", "is_default_password_admin", - "is_default_password_auditor" + "is_default_password_auditor", + "retention_days" ], "properties": { "host": { @@ -52,6 +54,11 @@ "type": "boolean", "title": "Default password", "description": "True if the password is the default one" + }, + "retention_days": { + "type": "integer", + "title": "Retention days", + "description": "Number of days to keep the emails" } } } diff --git a/imageroot/bin/expand-configuration b/imageroot/bin/expand-configuration index 59ef8b4..928d3ec 100755 --- a/imageroot/bin/expand-configuration +++ b/imageroot/bin/expand-configuration @@ -37,6 +37,7 @@ if os.environ.get("MAIL_SERVER", ''): properties = { "host": os.environ["TRAEFIK_HOST"], "provider_ip": os.environ["PROVIDER_IP"], + "retention_days": os.environ.get("RETENTION_DAYS", 2557), } json_properties = json.dumps(properties) diff --git a/imageroot/templates/piler.conf b/imageroot/templates/piler.conf index 84e4c29..37f0618 100644 --- a/imageroot/templates/piler.conf +++ b/imageroot/templates/piler.conf @@ -4,7 +4,7 @@ backlog=20 check_for_client_timeout_interval=20 cipher_list=ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS clamd_socket=/tmp/clamd -default_retention_days=2557 +default_retention_days={{retention_days}} enable_chunking=0 enable_cjk=0 enable_folders=0 diff --git a/ui/public/i18n/language.json b/ui/public/i18n/language.json index 06cd73b..fc3e499 100644 --- a/ui/public/i18n/language.json +++ b/ui/public/i18n/language.json @@ -49,7 +49,11 @@ "import_old_emails_to_piler_description": "Import old emails to Piler, this process may take a long time", "always_bcc_is_already_set": "Always BCC is already set in the server, you need to manually remove it (POSTFIX_ALWAYS_BCC)", "always_bcc_not_set_warning": "Always BCC is not set", - "always_bcc_not_set_description": "Always BCC is not set in the mail server, you could try to configure again piler" + "always_bcc_not_set_description": "Always BCC is not set in the mail server, you could try to configure again piler", + "retention_days": "Retention days", + "retention_days_error": "Enter a number greater than 0", + "placeholder_retention_days": "Type the number of days", + "retention_days_tooltip": "The number of days to keep the emails in the archive" }, "about": { "title": "About" diff --git a/ui/src/views/Settings.vue b/ui/src/views/Settings.vue index c72c74b..3358d9e 100644 --- a/ui/src/views/Settings.vue +++ b/ui/src/views/Settings.vue @@ -124,6 +124,21 @@ {{ $t("settings.choose_the_mail_server_to_use") }} + + +