Add variables for maintenance cleanup

This commit is contained in:
Antonio J. Delgado 2024-04-06 14:43:40 +03:00
parent 4f0878d038
commit 1a65942f36

View file

@ -70,6 +70,12 @@
# WARNING! This token will be in plain text in the System unit
# definition, so restrict it to only read public repos.
#
# [*media_retention_days*]
# Integer with the number of days to keep media attachments. Default 7.
#
# [*cards_retention_days*]
# Integer with the number of days to keep preview cards. Default 180.
#
class mastodon (
String $ensure = 'present',
String $hostname = 'mastodon.example.org',
@ -114,6 +120,8 @@ class mastodon (
String $cert_admin_mail = 'cert-admin@example.org',
Boolean $manage_updater_task = false,
String $github_token = '',
Integer $media_retention_days = 7,
Integer $cards_retention_days = 180,
) {
case $ensure {
default: {
@ -512,7 +520,7 @@ class mastodon (
User=${mastodon_user}
WorkingDirectory=${mastodon_home}/live
Environment='RAILS_ENV=production' 'PATH=${mastodon_home}/.rbenv/shims:${mastodon_home}/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
ExecStart=/opt/mastodon/live/bin/tootctl media remove --days 180
ExecStart=/opt/mastodon/live/bin/tootctl media remove --days ${media_retention_days}
[Unit]
OnFailure=status_email_antoniodelgado@%n.service
@ -545,7 +553,7 @@ class mastodon (
User=${mastodon_user}
WorkingDirectory=${mastodon_home}/live
Environment='RAILS_ENV=production' 'PATH=${mastodon_home}/.rbenv/shims:${mastodon_home}/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin'
ExecStart=/opt/mastodon/live/bin/tootctl preview_cards remove --days 180
ExecStart=/opt/mastodon/live/bin/tootctl preview_cards remove --days ${cards_retention_days}
[Unit]
OnFailure=status_email_antoniodelgado@%n.service