From 6f07f2c5c63de695616c8ba408d4278250e2c092 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 12 May 2023 20:19:43 +0200 Subject: [PATCH 1/3] Repository Upload Adding variables to configure repository upload more easily --- README.md | 6 ++++++ defaults/main.yml | 5 +++++ templates/gitea.ini.j2 | 3 +++ vars/main.yml | 2 +- 4 files changed, 15 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4fac809..3324210 100644 --- a/README.md +++ b/README.md @@ -94,6 +94,12 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_user_repo_limit` | `-1` | Limit how many repos a user can have *(`-1` for unlimited)* | | `gitea_repository_root` | `{{ gitea_home }}/repos` | Root path for storing all repository data. It must be an absolute path. | | `gitea_repository_extra_config` | | you can use this variable to pass additional config parameters in the `[repository]` section of the config. | + +### Repository - Upload ([repository.upload](https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload)) +| variable name | default value | description | +| ------------- | ------------- | ----------- | +| `gitea_repository_upload_enabled` | `true` | Whether repository file uploads are enabled | +| `gitea_repository_upload_max_size` | `4` | Max size of each file in megabytes. | | `gitea_repository_upload_extra_config` | | you can use this variable to pass additional config parameters in the `[repository.upload]` section of the config. | ### Repository - Signing ([repository.signing](https://docs.gitea.io/en-us/config-cheat-sheet/#repository---signing-repositorysigning)) diff --git a/defaults/main.yml b/defaults/main.yml index 98ffff5..ea46403 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -45,6 +45,11 @@ gitea_force_private: false gitea_user_repo_limit: '-1' gitea_repository_root: "{{ gitea_home }}/repos" gitea_repository_extra_config: '' + +# Repository - Upload (repository.upload) +# -> https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload +gitea_repository_upload_enabled: true +gitea_repository_upload_max_size: 4 gitea_repository_upload_extra_config: '' # Repository - Signing (repository.signing) diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 2ecf1d9..128b736 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -27,8 +27,11 @@ DEFAULT_BRANCH = {{ gitea_default_branch }} {{ gitea_repository_extra_config }} ; ; +; -> https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload [repository.upload] +ENABLED = {{ gitea_repository_upload_enabled | ternary('true', 'false') }} TEMP_PATH = {{ gitea_home }}/data/tmp/uploads +FILE_MAX_SIZE = {{ gitea_repository_upload_max_size }} {{ gitea_repository_upload_extra_config }} ; ; diff --git a/vars/main.yml b/vars/main.yml index b9a43e6..6a1b1f1 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -62,5 +62,5 @@ transfer_custom_footer: - 'files/gitea_footer/extra_links_footer.tmpl' - 'files/extra_links_footer.tmpl' -playbook_version_number: 46 # should be int +playbook_version_number: 47 # should be int playbook_version_path: 'do1jlr.gitea.version' From f3af1cdb7929b95d624266cac80fec267e809ea7 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 12 May 2023 20:32:28 +0200 Subject: [PATCH 2/3] Change gitea attachmet config options --- README.md | 2 ++ defaults/main.yml | 4 +++- templates/gitea.ini.j2 | 6 ++++-- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 3324210..d3e35e0 100644 --- a/README.md +++ b/README.md @@ -257,6 +257,8 @@ Either you define exactly which release you install. Or you use the option ``lat | variable name | default value | description | | ------------- | ------------- | ----------- | | `attachment_enabled` | `true` | Whether issue and pull request attachments are enabled. | +| `gitea_attachment_types` | see Docs | Comma-separated list of allowed file extensions (`.zip,.txt`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types. | +| `gitea_attachment_max_size` | `4` | Maximum size (MB). | | `gitea_attachment_extra_config` | | you can use this variable to pass additional config parameters in the `[attachment]` section of the config. | ### Log ([log](https://docs.gitea.io/en-us/config-cheat-sheet/#log-log)) diff --git a/defaults/main.yml b/defaults/main.yml index ea46403..9e2a8be 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -46,7 +46,7 @@ gitea_user_repo_limit: '-1' gitea_repository_root: "{{ gitea_home }}/repos" gitea_repository_extra_config: '' -# Repository - Upload (repository.upload) +# Repository - Upload (repository.upload) # -> https://docs.gitea.io/en-us/administration/config-cheat-sheet/#repository---upload-repositoryupload gitea_repository_upload_enabled: true gitea_repository_upload_max_size: 4 @@ -194,6 +194,8 @@ gitea_picture_extra_config: '' # Issue and pull request attachments (attachment) # -> https://docs.gitea.io/en-us/config-cheat-sheet/#issue-and-pull-request-attachments-attachment gitea_attachment_enabled: true +gitea_attachment_types: '.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip' +gitea_attachment_max_size: 4 gitea_attachment_extra_config: '' # Log (log) diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index 128b736..4834259 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -216,8 +216,10 @@ AVATAR_UPLOAD_PATH = {{ gitea_home }}/data/avatars ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#issue-and-pull-request-attachments-attachment [attachment] -ENABLED = {{ gitea_attachment_enabled | ternary('true', 'false') }} -PATH = {{ gitea_home }}/data/attachments +ENABLED = {{ gitea_attachment_enabled | ternary('true', 'false') }} +ALLOWED_TYPES = {{ gitea_attachment_types }} +MAX_SIZE = {{ gitea_attachment_max_size }} +PATH = {{ gitea_home }}/data/attachments {{ gitea_attachment_extra_config }} ; ; From 7aec3c13816f709bc87b50b385b97f62f26205c5 Mon Sep 17 00:00:00 2001 From: L3D Date: Fri, 12 May 2023 21:00:33 +0200 Subject: [PATCH 3/3] filelength --- .yamllint | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.yamllint b/.yamllint index e9713ae..2e52fdc 100644 --- a/.yamllint +++ b/.yamllint @@ -2,7 +2,7 @@ extends: default rules: - # 170 chars should be enough, but don't fail if a line is longer + # 190 chars should be enough, but don't fail if a line is longer line-length: - max: 170 + max: 190 level: warning