diff --git a/README.md b/README.md index 104509e..ca88133 100644 --- a/README.md +++ b/README.md @@ -146,6 +146,8 @@ Here is a deeper insight into the variables of this gitea role. For the exact fu | `gitea_security_extra_config` | `''` | you can use this variable to pass additional config parameters in the `[security]` section of the config. | ### Service ([service](https://docs.gitea.io/en-us/config-cheat-sheet/#service-service)) +| variable name | default value | description | +| ------------- | ------------- | ----------- | | `gitea_disable_registration` | `false` | Do you want to disable user registration? (true/false) | | `gitea_register_email_confirm` | `false` | Enable this to ask for mail confirmation of registration. Requires `gitea_mailer_enabled` to be enabled. | | `gitea_require_signin` | `true` | Do you require a signin to see repo's (even public ones)? (true/false)| @@ -156,8 +158,25 @@ Here is a deeper insight into the variables of this gitea role. For the exact fu | `gitea_auto_watch_new_repos` | `true` | Enable this to let all organisation users watch new repos when they are created (true/false) | | `gitea_service_extra_config` | `''` | you can use this variable to pass additional config parameters in the `[service]` section of the config. | +### Mailer ([mailer](https://docs.gitea.io/en-us/config-cheat-sheet/#mailer-mailer)) +| variable name | default value | description | +| ------------- | ------------- | ----------- | +| `gitea_mailer_enabled` | `false` | Whether to enable the mailer. | +| `gitea_mailer_host` | `localhost:25` | SMTP server hostname and port | +| `gitea_mailer_skip_verify` | `false` | Skip SMTP TLS certificate verification (true/false) | +| `gitea_mailer_tls_enabled` | `true` | Forcibly use TLS to connect even if not on a default SMTPS port. | +| `gitea_mailer_from` | `noreply@{{ gitea_http_domain }}` | Mail from address, RFC 5322. This can be just an email address, or the “Name” format. | +| `gitea_mailer_user` | `''` | Username of mailing user *(usually the sender’s e-mail address)*. | +| `gitea_mailer_password` | `''` | SMTP server password | +| `gitea_subject_prefix` | `''` | Prefix to be placed before e-mail subject lines | +| `gitea_mailer_type` | `smtp` | `[smtp, sendmail, dummy]` | +| `gitea_mailer_extra_config` | `''` | you can use this variable to pass additional config parameters in the `[mailer]` section of the config. | +| `gitea_enable_notify_mail`: Whether e-mail should be send to watchers of a repository when something happens. Default: `false` + +### LFS configuration + ### Look and feel @@ -182,17 +201,6 @@ Here is a deeper insight into the variables of this gitea role. For the exact fu ### Mailer configuration -* `gitea_mailer_enabled`: Whether to enable the mailer. Default: `false` -* `gitea_mailer_skip_verify`: Skip SMTP TLS certificate verification (true/false) -* `gitea_mailer_tls_enabled`: Enable TLS for SMTP connections (true/false) -* `gitea_mailer_host`: SMTP server hostname and port -* `gitea_mailer_user`: SMTP server username -* `gitea_mailer_password`: SMTP server password -* `gitea_mailer_from`: Sender mail address -* `gitea_subject_prefix`: Prefix to be placed before e-mail subject lines (Default: ``) -* `gitea_enable_notify_mail`: Whether e-mail should be send to watchers of a repository when something happens. Default: `false` - -### LFS configuration ### Log configuration diff --git a/defaults/main.yml b/defaults/main.yml index 4d7bb70..b6ef213 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -90,6 +90,19 @@ gitea_enable_notify_mail: false gitea_auto_watch_new_repos: true gitea_service_extra_config: '' +# Mailer [mailer] +# -> https://docs.gitea.io/en-us/config-cheat-sheet/#mailer-mailer +gitea_mailer_enabled: false +gitea_mailer_host: 'localhost:25' +gitea_mailer_skip_verify: false +gitea_mailer_tls_enabled: true +gitea_mailer_from: "noreply@{{ gitea_http_domain }}" +gitea_mailer_user: '' +gitea_mailer_password: '' +gitea_subject_prefix: '' +gitea_mailer_type: smtp +gitea_mailer_extra_config: '' + # look and feel gitea_disable_gravatar: true @@ -99,15 +112,6 @@ gitea_oauth2_jwt_secret: '' gitea_systemd_cap_net_bind_service: false -gitea_mailer_enabled: false -gitea_mailer_skip_verify: false -gitea_mailer_tls_enabled: true -gitea_mailer_host: localhost:25 -gitea_mailer_from: noreply@your.domain -gitea_mailer_user: "" -gitea_mailer_password: "" -gitea_subject_prefix: "" -gitea_mailer_type: smtp gitea_log_systemd: false gitea_log_only_warning: true diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index a5a9ffa..f0911ea 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -98,48 +98,32 @@ PASSWORD_CHECK_PWN = {{ gitea_password_check_pwn | ternary('true', 'false') }} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#service-service [service] -DISABLE_REGISTRATION = {{ gitea_disable_registration | ternary('true', 'false') }} -REGISTER_EMAIL_CONFIRM = {{ gitea_register_email_confirm | ternary('true', 'false') }} -REQUIRE_SIGNIN_VIEW = {{ gitea_require_signin | ternary('true', 'false') }} -ENABLE_CAPTCHA = {{ gitea_enable_captcha | ternary('true', 'false') }} -SHOW_REGISTRATION_BUTTON = {{ gitea_show_registration_button | ternary('true', 'false') }} -ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_only_allow_external_registration | ternary('true', 'false') }} -ENABLE_NOTIFY_MAIL = {{ gitea_enable_notify_mail | ternary('true', 'false') }} -AUTO_WATCH_NEW_REPOS = {{ gitea_auto_watch_new_repos | ternary('true', 'false') }} +DISABLE_REGISTRATION = {{ gitea_disable_registration | ternary('true', 'false') }} +REGISTER_EMAIL_CONFIRM = {{ gitea_register_email_confirm | ternary('true', 'false') }} +REQUIRE_SIGNIN_VIEW = {{ gitea_require_signin | ternary('true', 'false') }} +ENABLE_CAPTCHA = {{ gitea_enable_captcha | ternary('true', 'false') }} +SHOW_REGISTRATION_BUTTON = {{ gitea_show_registration_button | ternary('true', 'false') }} +ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_only_allow_external_registration | ternary('true', 'false') }} +ENABLE_NOTIFY_MAIL = {{ gitea_enable_notify_mail | ternary('true', 'false') }} +AUTO_WATCH_NEW_REPOS = {{ gitea_auto_watch_new_repos | ternary('true', 'false') }} {{ gitea_service_extra_config }} ; ; -; - +; -> https://docs.gitea.io/en-us/config-cheat-sheet/#mailer-mailer [mailer] ENABLED = {{ gitea_mailer_enabled | ternary('true', 'false') }} -; Mail server -; Gmail: smtp.gmail.com:587 -; QQ: smtp.qq.com:465 -; Note, if the port ends with "465", SMTPS will be used. Using STARTTLS on port 587 is recommended per RFC 6409. If the server supports STARTTLS it will always be used. HOST = {{ gitea_mailer_host }} -; Do not verify the certificate of the server. Only use this for self-signed certificates SKIP_VERIFY = {{ gitea_mailer_skip_verify }} -; Use client certificate -USE_CERTIFICATE = false -CERT_FILE = {{ gitea_home }}/custom/mailer/cert.pem -KEY_FILE = {{ gitea_home }}/custom/mailer/key.pem -; Should SMTP connection use TLS IS_TLS_ENABLED = {{ gitea_mailer_tls_enabled | ternary('true', 'false') }} -; Mail from address, RFC 5322. This can be just an email address, or the `"Name" ` format FROM = {{ gitea_mailer_from }} -; Mailer user name and password USER = {{ gitea_mailer_user }} -; Use PASSWD = `your password` for quoting if you use special characters in the password. PASSWD = {{ gitea_mailer_password }} -; Send mails as plain text -SEND_AS_PLAIN_TEXT = false -SUBJECT_PREFIX = {{ gitea_subject_prefix }} -; Set Mailer Type (either SMTP, sendmail or dummy to just send to the log) +SUBJECT_PREFIX = {{ gitea_subject_prefix }} MAILER_TYPE = {{ gitea_mailer_type }} -; Specify an alternative sendmail binary -SENDMAIL_PATH = sendmail - +{{ gitea_mailer_extra_config }} +; +; +; [session] ; Either "memory", "file", or "redis", default is "memory" PROVIDER = file