diff --git a/defaults/main.yml b/defaults/main.yml index b102989..f9b9ca0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,5 @@ --- -gitea_version: 1.10.0 +gitea_version: 1.11.0 gitea_user: "gitea_adm" gitea_user_home: "/home/{{ gitea_user }}" gitea_group: "{{ gitea_user }}" @@ -14,23 +14,59 @@ gitea_config_dir: "{{ gitea_base_dir }}/custom/conf" gitea_data_dir: "{{ gitea_base_dir }}/data" gitea_selinux_fcontext: - - target: "{{ gitea_global_log_dir }}(/.*)?" + - target: "{{ gitea_log_dir }}(/.*)?" setype: var_log_t gitea_selinux_restorecon: - - "-ir {{ gitea_global_log_dir }}" + - "-ir {{ gitea_log_dir }}" gitea_bind_ip: 127.0.0.1 gitea_bind_port: 61000 gitea_listen_address: http://gitea.example.com -gitea_install_lock: "true" +gitea_install_lock: True # @var gitea_secret:description: Should be replaced by your own secret. gitea_secret: "1234567ABCDEFG" # @var gitea_token:description: Should be replaced by your own secret. gitea_token: "akslkaldasasifiuvsiasfa7s7f8as7f8asd" gitea_run_mode: prod +gitea_login_remember_days: 7 +gitea_password_min_lenght: 8 +# @var gitea_password_complexity:description: > +# If left empty or no valid values are specified, the default values +# `lower,upper,digit,spec` will be used. Use `off` to disable checking. +# @end +gitea_password_complexity: + - lower + - upper + - digit + - spec +gitea_git_hooks_enabled: True + gitea_landing_page: explore -gitea_disable_registration: "true" +gitea_ssh_enabled: True +# @var gitea_minimum_keysize_check:description: > +# Indicate whether to check minimum key size with corresponding type. +# @end +gitea_minimum_keysize_check: False +# @var gitea_minimum_keysize:description: > +# Define allowed algorithms and their minimum key length (use -1 to disable a type). +# @end +gitea_minimum_keysize: + - name: ED25519 + size: 256 + - name: ECDSA + size: 256 + - name: RSA + size: 2048 + - name: DSA + size: -1 +gitea_offline_mode: False + +gitea_registration_enabled: False +gitea_registration_email_confirm: False +gitea_registration_email_domain_whitelist: [] +gitea_registration_allow_external_only: False +gitea_registration_button_enabled: True gitea_db_type: pgsql gitea_db_server: localhost @@ -38,32 +74,177 @@ gitea_db_port: 5432 gitea_db_name: gitea gitea_db_user: pggitea gitea_db_password: secure - gitea_db_ssl_mode: disable -gitea_global_log_level: Info -gitea_global_log_dir: "{{ gitea_base_dir }}/log" -gitea_file_log_level: "{{ gitea_global_log_level }}" +# @var gitea_default_email_notification:description: > +# Default configuration for email notifications for users (user configurable). +# Options: `enabled`, `onmention`, `disabled`. +# @end +gitea_default_email_notification: enabled +gitea_default_keep_email_private: True +gitea_default_org_allow_creation: True +gitea_default_org_visible: public +gitea_default_org_member_visible: False +gitea_default_dependencies_enabled: True +gitea_default_timetracking_enabled: True +gitea_log_level: Info +gitea_log_dir: "{{ gitea_base_dir }}/log" + +gitea_repository_default_private: last +gitea_repository_force_private: False +gitea_repository_default_license: + - Apache License 2.0 + - MIT Licensei +gitea_repository_creation_limit: -1 +gitea_repository_http_enabled: True +# @var gitea_repository_access_control_allow_origin:default: $ "_unset_" +# @var gitea_repository_access_control_allow_origin:description: > +# Value for Access-Control-Allow-Origin header, default unset. +# WARNING: This maybe harmful to you website if you do not give it a right value! +# @end +# @var gitea_repository_use_compat_ssh_uri:description: > +# Force ssh:// clone url instead of scp-style uri when default SSH port is used +# @end +gitea_repository_use_compat_ssh_uri: False +gitea_repository_push_create_user_enabled: False +gitea_repository_push_create_org_enabled: False +gitea_repository_auto_watch_on_creation: False +gitea_repository_auto_watch_on_change: False +# @var gitea_repository_editor_line_wrap_ext:description: > +# Comma-separated list of file extensions for which lines should be wrapped in the CodeMirror editor. +# To line wrap files without an extension, just put a comma. +# @end +gitea_repository_editor_line_wrap_ext: + - .txt + - .md + - .markdown + - .mdown + - .mkd +gitea_repository_upload_enabled: True +# @var gitea_repository_upload_allowed_types:description: > +# One or more allowed types, e.g. image/jpeg|image/png. Default allows any file type. +# @end +gitea_repository_upload_allowed_types: [] gitea_repository_upload_max_filesize: 3 gitea_repository_upload_max_files: 5 +# @var gitea_repository_pr_wip_prefix:description: > +# List of prefixes used in Pull Request title to mark them as Work In Progress. +# @end +gitea_repository_pr_wip_prefix: + - "WIP:" + - "[WIP]" +gitea_repository_pr_close_keyword: + - close + - closes + - closed + - fix + - fixes + - fixed + - resolve + - resolves + - resolved +gitea_repository_pr_reopen_keyword: + - reopen + - reopens + - reopened +# @var gitea_repository_issue_lock_reason:description: > +# List of reasons why a Pull Request or Issue can be locked. +# @end +gitea_repository_issue_lock_reason: + - Too heated + - Off-topic + - Resolved + - Spam + +gitea_ui_explore_paging_num: 20 +gitea_ui_issue_paging_num: 10 +gitea_ui_feed_commit_num: 5 +gitea_ui_graph_commit_num: 100 +gitea_ui_code_comment_lines: 4 +gitea_ui_show_user_email: True +# @var gitea_ui_reaction:description: > +# All available reactions. Allow users react with different emojis. +# See https://gitea.com/gitea/gitea.com/issues/8. +# @end +gitea_ui_reaction: + - +1 + - -1 + - laugh + - hooray + - confused + - heart + - rocket + - eyes +gitea_ui_show_full_name: False +gitea_ui_search_repo_description: True + +gitea_ui_admin_user_paging_num: 50 +gitea_ui_admin_repo_paging_num: 50 +gitea_ui_admin_notice_paging_num: 25 +gitea_ui_admin_org_paging_num: 50 +gitea_ui_user_repo_paging_num: 15 + +gitea_markdown_hard_linebreak_enabled: False +gitea_markdown_custom_url_scheme: [] +gitea_markdown_file_ext: + - .md + - .markdown + - .mdown + - .mkd + +gitea_lfs_enabled: False +gitea_lfs_jwt_secret: gitea_lfs_jwt_secret + +# @var gitea_org_creation_enabled: description: > +# Allow regular (non-admin) users to create organizations. +# @end +gitea_org_creation_enabled: True + +gitea_gravatar_enabled: False +gitea_gravatar_source: gravatar +gitea_avatar_federation_enabled: False + +gitea_attachment_enabled: True +gitea_attachment_allowed_types: + - image/jpeg + - image/png + - application/zip + - application/gzip gitea_attachment_max_filesize: 3 gitea_attachment_max_files: 5 +gitea_mirror_default_interval: 8h +gitea_mirror_min_interval: 10h + gitea_mail_service_enabled: False gitea_mail_service_from: '"System" ' gitea_no_reply_address: noreply.example.org +# @var gitea_mail_subject_prefix:default: $ "_unset_" +# @var gitea_mail_subject_prefix:description: Prefix displayed before subject in mail. + +gitea_api_swagger_enabled: True +gitea_api_default_paging_num: 30 +gitea_api_default_git_trees_per_page: 1000 + +gitea_show_footer_branding: False +gitea_show_footer_version: False +gitea_show_footer_template_load_time: False gitea_oauth_provider_enabled: False gitea_access_token_expiration_time: 3600 gitea_refresh_token_expiration_time: 730 -gitea_invalidate_refresh_tokens: "false" +gitea_invalidate_refresh_tokens: False # @bar gitea_jwt_secret:description: > # OAuth2 authentication secret for access and refresh tokens. # Should be replaced by your own secret. # @end gitea_jwt_secret: Bk0yK7Y9g_p56v86KaHqjSbxvNvu3SbKoOdOt2ZcXvU +gitea_metrics_enabled: False +# @var gitea_metrics_token:description: If you want to add authorization, specify a token here. +# @var gitea_metrics_token:default: $ "_unset_" + gitea_tls_enabled: False gitea_tls_cert_path: "{{ gitea_base_dir }}/tls/certs/mycert.pem" gitea_tls_key_path: "{{ gitea_base_dir }}/tls/private/mykey.pem" diff --git a/templates/custom/conf/app.ini.j2 b/templates/custom/conf/app.ini.j2 index 03bbbbd..84a4570 100644 --- a/templates/custom/conf/app.ini.j2 +++ b/templates/custom/conf/app.ini.j2 @@ -1,189 +1,221 @@ #jinja2: lstrip_blocks: True -{{ ansible_managed | comment }} +{{ ansible_managed | comment(decoration="; ")}} APP_NAME = Gitea: Git with a cup of tea RUN_USER = {{ gitea_user }} RUN_MODE = {{ gitea_run_mode }} [repository] -ROOT = {{ gitea_data_dir }}/repos -SCRIPT_TYPE = bash -ANSI_CHARSET = -FORCE_PRIVATE = false -DEFAULT_PRIVATE = public -MAX_CREATION_LIMIT = -1 -MIRROR_QUEUE_LENGTH = 1000 -PULL_REQUEST_QUEUE_LENGTH = 1000 -DISABLE_HTTP_GIT = false -PREFERRED_LICENSES = MIT License -ACCESS_CONTROL_ALLOW_ORIGIN = -USE_COMPAT_SSH_URI = false -DEFAULT_CLOSE_ISSUES_VIA_COMMITS_IN_ANY_BRANCH = false +ROOT = {{ gitea_data_dir }}/repos +FORCE_PRIVATE = {{ gitea_repository_force_private | bool | lower }} +DEFAULT_PRIVATE = {{ gitea_repository_default_private }} +MAX_CREATION_LIMIT = {{ gitea_repository_creation_limit }} +PREFERRED_LICENSES = {{ gitea_repository_default_license | join(",") }} +DISABLE_HTTP_GIT = {{ 'false' if gitea_repository_http_enabled | bool else 'true' }} +{% if gitea_repository_access_control_allow_origin is defined and gitea_repository_access_control_allow_origin %} +ACCESS_CONTROL_ALLOW_ORIGIN = {{ gitea_repository_access_control_allow_origin }} +{% endif %} +USE_COMPAT_SSH_URI = {{ gitea_repository_use_compat_ssh_uri | bool | lower }} +ENABLE_PUSH_CREATE_USER = {{ gitea_repository_push_create_user_enabled | bool | lower }} +ENABLE_PUSH_CREATE_ORG = {{ gitea_repository_push_create_org_enabled | bool | lower }} [repository.editor] -LINE_WRAP_EXTENSIONS = .txt,.md,.markdown,.mdown,.mkd, +LINE_WRAP_EXTENSIONS = {{ gitea_repository_editor_line_wrap_ext | join(",") }} PREVIEWABLE_FILE_MODES = markdown -[repository.local] -LOCAL_COPY_PATH = tmp/local-repo -LOCAL_WIKI_PATH = tmp/local-wiki - [repository.upload] -ENABLED = true -TEMP_PATH = tmp/uploads -ALLOWED_TYPES = +{% if gitea_repository_upload_enabled | bool %} +ENABLED = true +{% if gitea_repository_upload_allowed_types %} +ALLOWED_TYPES = {{ gitea_repository_upload_allowed_types | join(",") }} +{% endif %} FILE_MAX_SIZE = {{ gitea_repository_upload_max_filesize }} -MAX_FILES = {{ gitea_repository_upload_max_files }} +MAX_FILES = {{ gitea_repository_upload_max_files }} +{% else %} +ENABLED = false +{% endif %} [repository.pull-request] -WORK_IN_PROGRESS_PREFIXES = WIP:,[WIP] +WORK_IN_PROGRESS_PREFIXES = {{ gitea_repository_pr_wip_prefix | join(",") }} +CLOSE_KEYWORDS = {{ gitea_repository_pr_close_keyword | join(",") }} +REOPEN_KEYWORDS = {{ gitea_repository_pr_reopen_keyword | join(",") }} [repository.issue] -LOCK_REASONS = Too heated,Off-topic,Resolved,Spam +LOCK_REASONS = {{ gitea_repository_issue_lock_reason | join(",") }} [ui] -EXPLORE_PAGING_NUM = 20 -ISSUE_PAGING_NUM = 10 -FEED_MAX_COMMIT_NUM = 5 -MAX_DISPLAY_FILE_SIZE = 8388608 -SHOW_USER_EMAIL = true -GRAPH_MAX_COMMIT_NUM = 100 -CODE_COMMENT_LINES = 4 -DEFAULT_THEME = gitea -DEFAULT_SHOW_FULL_NAME = false +EXPLORE_PAGING_NUM = {{ gitea_ui_explore_paging_num }} +ISSUE_PAGING_NUM = {{ gitea_ui_issue_paging_num }} +FEED_MAX_COMMIT_NUM = {{ gitea_ui_feed_commit_num }} +GRAPH_MAX_COMMIT_NUM = {{ gitea_ui_graph_commit_num }} +CODE_COMMENT_LINES = {{ gitea_ui_code_comment_lines }} +SHOW_USER_EMAIL = {{ gitea_ui_show_user_email | bool | lower }} +REACTIONS = {{ gitea_ui_reaction | join(",") }} +DEFAULT_SHOW_FULL_NAME = {{ gitea_ui_show_full_name | bool | lower }} +SEARCH_REPO_DESCRIPTION = {{ gitea_ui_search_repo_description | bool | lower }} [ui.admin] -USER_PAGING_NUM = 50 -REPO_PAGING_NUM = 50 -NOTICE_PAGING_NUM = 25 -ORG_PAGING_NUM = 50 +USER_PAGING_NUM = {{ gitea_ui_admin_user_paging_num }} +REPO_PAGING_NUM = {{ gitea_ui_admin_repo_paging_num }} +NOTICE_PAGING_NUM = {{ gitea_ui_admin_notice_paging_num }} +ORG_PAGING_NUM = {{ gitea_ui_admin_org_paging_num }} [ui.user] -REPO_PAGING_NUM = 15 - -[ui.meta] -AUTHOR = Gitea - Git with a cup of tea -DESCRIPTION = Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go -KEYWORDS = go,git,self-hosted,gitea +REPO_PAGING_NUM = {{ gitea_ui_user_repo_paging_num }} [markdown] -ENABLE_HARD_LINE_BREAK = false -CUSTOM_URL_SCHEMES = -FILE_EXTENSIONS = .md,.markdown,.mdown,.mkd +ENABLE_HARD_LINE_BREAK = {{ gitea_markdown_hard_linebreak_enabled | bool | lower }} +{% if gitea_markdown_custom_url_scheme %} +CUSTOM_URL_SCHEMES = {{ gitea_markdown_custom_url_scheme | join(",") }} +{% endif %} +FILE_EXTENSIONS = {{ gitea_markdown_file_ext }} [server] -PROTOCOL = {{ 'https' if gitea_tls_enabled else 'http' }} -DOMAIN = {{ gitea_listen_address | urlsplit('hostname') }} -ROOT_URL = {{ gitea_listen_address | urlsplit('scheme') }}://%(DOMAIN)s/ -HTTP_ADDR = {{ gitea_bind_ip }} -HTTP_PORT = {{ gitea_bind_port }} -REDIRECT_OTHER_PORT = false -{% if gitea_tls_enabled %} -CERT_FILE = {{ gitea_tls_cert_path }} -KEY_FILE = {{ gitea_tls_key_path }} +PROTOCOL = {{ 'https' if gitea_tls_enabled else 'http' }} +DOMAIN = {{ gitea_listen_address | urlsplit('hostname') }} +ROOT_URL = {{ gitea_listen_address | urlsplit('scheme') }}://%(DOMAIN)s/ +HTTP_ADDR = {{ gitea_bind_ip }} +HTTP_PORT = {{ gitea_bind_port }} +LOCAL_ROOT_URL = %(PROTOCOL)s://%(HTTP_ADDR)s:%(HTTP_PORT)s/ +DISABLE_SSH = {{ 'false' if gitea_ssh_enabled | bool else 'true' }} +START_SSH_SERVER = false +MINIMUM_KEY_SIZE_CHECK = {{ gitea_minimum_keysize_check | bool | lower }} +OFFLINE_MODE = {{ gitea_offline_mode | bool | lower }} +{% if gitea_tls_enabled | bool %} +CERT_FILE = {{ gitea_tls_cert_path }} +KEY_FILE = {{ gitea_tls_key_path }} +{% endif %} +APP_DATA_PATH = {{ gitea_data_dir }} +PPROF_DATA_PATH = {{ gitea_data_dir }}/tmp/pprof +LANDING_PAGE = {{ gitea_landing_page }} +{% if gitea_lfs_enabled | bool %} +LFS_START_SERVER = true +LFS_CONTENT_PATH = {{ gitea_data_dir }}/lfs +LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }} +LFS_HTTP_AUTH_EXPIRY = 20m +{% else %} +LFS_START_SERVER = false {% endif %} -UNIX_SOCKET_PERMISSION = 666 -LANDING_PAGE = {{ gitea_landing_page }} -START_SSH_SERVER = false -MINIMUM_KEY_SIZE_CHECK = true -OFFLINE_MODE = false -ENABLE_PPROF = false [ssh.minimum_key_sizes] -ED25519 = 256 -ECDSA = 256 -RSA = 2048 +{% for key in gitea_minimum_keysize %} +{{ key.name }} = {{ key.size }} +{% endfor %} [database] {% if gitea_db_type == "pgsql" %} -DB_TYPE = postgres -HOST = {{ gitea_db_server }}:{{ gitea_db_port }} -NAME = {{ gitea_db_name }} -USER = {{ gitea_db_user }} -PASSWD = {{ gitea_db_password }} -SSL_MODE = {{ gitea_db_ssl_mode }} +DB_TYPE = postgres +HOST = {{ gitea_db_server }}:{{ gitea_db_port }} +NAME = {{ gitea_db_name }} +USER = {{ gitea_db_user }} +PASSWD = {{ gitea_db_password }} +SSL_MODE = {{ gitea_db_ssl_mode }} {% else %} -DB_TYPE = sqlite3 -PATH = {{ gitea_data_dir }}/gitea.db -SQLITE_TIMEOUT = 500 +DB_TYPE = sqlite3 +PATH = {{ gitea_data_dir }}/gitea.db +SQLITE_TIMEOUT = 500 {% endif %} -ITERATE_BUFFER_SIZE = 50 -LOG_SQL = true -DB_RETRIES = 10 -DB_RETRY_BACKOFF = 3s [indexer] -ISSUE_INDEXER_TYPE = bleve -ISSUE_INDEXER_QUEUE_TYPE = levelqueue -ISSUE_INDEXER_PATH = {{ gitea_data_dir }}/indexers/issues.bleve -REPO_INDEXER_PATH = {{ gitea_data_dir }}/indexers/repos.bleve -ISSUE_INDEXER_QUEUE_DIR = {{ gitea_data_dir }}/issues.queue -REPO_INDEXER_ENABLED = true +ISSUE_INDEXER_TYPE = bleve +ISSUE_INDEXER_PATH = {{ gitea_data_dir }}/indexers/issues.bleve +ISSUE_INDEXER_QUEUE_DIR = {{ gitea_data_dir }}/issues.queue +REPO_INDEXER_ENABLED = true +REPO_INDEXER_PATH = {{ gitea_data_dir }}/indexers/repos.bleve [admin] -DISABLE_REGULAR_ORG_CREATION = false +DISABLE_REGULAR_ORG_CREATION = {{ 'false' if gitea_org_creation_enabled | bool else 'true' }} +DEFAULT_EMAIL_NOTIFICATIONS = {{ gitea_default_email_notification }} [security] -INSTALL_LOCK = {{ gitea_install_lock }} -SECRET_KEY = {{ gitea_secret }} -LOGIN_REMEMBER_DAYS = 7 -COOKIE_USERNAME = gitea_awesome -COOKIE_REMEMBER_NAME = gitea_incredible -INTERNAL_TOKEN = {{ gitea_token }} -MIN_PASSWORD_LENGTH = 8 -DISABLE_GIT_HOOKS = false +INSTALL_LOCK = {{ gitea_install_lock | bool | lower }} +SECRET_KEY = {{ gitea_secret }} +LOGIN_REMEMBER_DAYS = {{ gitea_login_remember_days }} +MIN_PASSWORD_LENGTH = {{ gitea_password_min_lenght }} +DISABLE_GIT_HOOKS = {{ 'false' if gitea_git_hooks_enabled | bool else 'true' }} +PASSWORD_COMPLEXITY = {{ gitea_password_complexity | join(",") }} +PASSWORD_HASH_ALGO = pbkdf2 +INTERNAL_TOKEN = {{ gitea_token }} [service] -DISABLE_REGISTRATION = {{ gitea_disable_registration }} -{% if gitea_mail_service_enabled %} -ENABLE_NOTIFY_MAIL = true +REGISTER_EMAIL_CONFIRM = {{ gitea_registration_email_confirm | bool }} +{% if gitea_registration_email_domain_whitelist is defined and gitea_registration_email_domain_whitelist %} +EMAIL_DOMAIN_WHITELIST= {{ gitea_registration_email_domain_whitelist | join(",") }} {% endif %} -ENABLE_USER_HEATMAP = true -ENABLE_CAPTCHA = false -ENABLE_TIMETRACKING = true -AUTO_WATCH_NEW_REPOS = false -DEFAULT_KEEP_EMAIL_PRIVATE = false -NO_REPLY_ADDRESS = "{{ gitea_no_reply_address }}" +DISABLE_REGISTRATION = {{ 'false' if gitea_registration_enabled | bool else 'true' }} +ALLOW_ONLY_EXTERNAL_REGISTRATION = {{ gitea_registration_allow_external_only | bool }} +REQUIRE_SIGNIN_VIEW = false +{% if gitea_mail_service_enabled | bool %} +ENABLE_NOTIFY_MAIL = true +{% endif %} +ENABLE_BASIC_AUTHENTICATION = true +ALLOW_CROSS_REPOSITORY_DEPENDENCIES = true +ENABLE_USER_HEATMAP = true +ENABLE_TIMETRACKING = true +NO_REPLY_ADDRESS = {{ gitea_no_reply_address }} +SHOW_REGISTRATION_BUTTON = {{ gitea_registration_button_enabled | bool }} +SHOW_MILESTONES_DASHBOARD_PAGE = true +AUTO_WATCH_NEW_REPOS = {{ gitea_repository_auto_watch_on_creation | bool }} +AUTO_WATCH_ON_CHANGES = {{ gitea_repository_auto_watch_on_change | bool }} +DEFAULT_KEEP_EMAIL_PRIVATE = {{ gitea_default_keep_email_private | bool }} +DEFAULT_ALLOW_CREATE_ORGANIZATION = {{ gitea_default_org_allow_creation | bool }} +DEFAULT_ORG_VISIBILITY = {{ gitea_default_org_visible }} +DEFAULT_ORG_MEMBER_VISIBLE = {{ gitea_default_org_member_visible | bool }} +DEFAULT_ENABLE_DEPENDENCIES = {{ gitea_default_dependencies_enabled | bool }} +DEFAULT_ENABLE_TIMETRACKING = {{ gitea_default_timetracking_enabled | bool }} +DEFAULT_ALLOW_ONLY_CONTRIBUTORS_TO_TRACK_TIME = true -{% if gitea_mail_service_enabled %} +{% if gitea_mail_service_enabled | bool %} [mailer] -ENABLED = true -SUBJECT = %(APP_NAME)s -FROM = {{ gitea_mail_service_from }} -MAILER_TYPE = sendmail +ENABLED = true +{% if gitea_mail_subject_prefix is defined and gitea_mail_subject_prefix %} +SUBJECT_PREFIX = {{ gitea_mail_subject_prefix }} +{% endif %} +FROM = {{ gitea_mail_service_from }} +MAILER_TYPE = sendmail SENDMAIL_PATH = /usr/sbin/sendmail -SENDMAIL_ARGS = {% else %} [mailer] ENABLED = false {% endif %} [picture] -AVATAR_UPLOAD_PATH = {{ gitea_data_dir }}/avatars -DISABLE_GRAVATAR = true -ENABLE_FEDERATED_AVATAR = false +AVATAR_UPLOAD_PATH = {{ gitea_data_dir }}/avatars +REPOSITORY_AVATAR_UPLOAD_PATH = {{ gitea_data_dir }}/repo-avatars +REPOSITORY_AVATAR_FALLBACK = random +DISABLE_GRAVATAR = {{ 'false' if gitea_gravatar_enabled | bool else 'true' }} +GRAVATAR_SOURCE = {{ gitea_gravatar_source }} +ENABLE_FEDERATED_AVATAR = {{ gitea_avatar_federation_enabled | bool }} [attachment] -ENABLE = true -PATH = {{ gitea_data_dir }}/attachments -ALLOWED_TYPES = */* -MAX_SIZE = {{ gitea_attachment_max_filesize }} -MAX_FILES = {{ gitea_attachment_max_files }} +{% if gitea_attachment_enabled | bool %} +ENABLE = true +PATH = {{ gitea_data_dir }}/attachments +ALLOWED_TYPES = {{ gitea_attachment_allowed_types | join("|") }} +MAX_SIZE = {{ gitea_attachment_max_filesize }} +MAX_FILES = {{ gitea_attachment_max_files }} +{% else %} +ENABLE = false +{% endif %} [log] -ROOT_PATH = {{ gitea_global_log_dir }} -MODE = file -BUFFER_LEN = 10000 -LEVEL = {{ gitea_global_log_level }} +ROOT_PATH = {{ gitea_log_dir }} +MODE = file REDIRECT_MACARON_LOG = true -ENABLE_ACCESS_LOG = true +MACARON = file +ROUTER_LOG_LEVEL = Info +ROUTER = file +ENABLE_ACCESS_LOG = true +ACCESS_LOG_TEMPLATE = {{.Ctx.RemoteAddr}} - {{.Identity}} {{.Start.Format "[02/Jan/2006:15:04:05 -0700]" }} "{{.Ctx.Req.Method}} {{.Ctx.Req.RequestURI}} {{.Ctx.Req.Proto}}" {{.ResponseWriter.Status}} {{.ResponseWriter.Size}} "{{.Ctx.Req.Referer}}\" \"{{.Ctx.Req.UserAgent}}" +ACCESS = file +LEVEL = {{ gitea_log_level }} +STACKTRACE_LEVEL = None [log.file] -LEVEL = {{ gitea_file_log_level }} -LOG_ROTATE = false +LOG_ROTATE = false [cron] -ENABLED = true +ENABLED = true RUN_AT_START = false [cron.update_mirrors] @@ -191,45 +223,67 @@ SCHEDULE = @every 10m [cron.repo_health_check] SCHEDULE = @every 24h -TIMEOUT = 60s +TIMEOUT = +ARGS = [cron.check_repo_stats] RUN_AT_START = true -SCHEDULE = @every 24h +SCHEDULE = @every 24h [cron.archive_cleanup] +ENABLED = true RUN_AT_START = true -SCHEDULE = @every 24h -OLDER_THAN = 24h +SCHEDULE = @every 24h +OLDER_THAN = 24h [cron.sync_external_users] -RUN_AT_START = true -SCHEDULE = @every 24h +RUN_AT_START = true +SCHEDULE = @every 24h UPDATE_EXISTING = true +[cron.update_migration_post_id] +SCHEDULE = @every 24h + +[mirror] +DEFAULT_INTERVAL = {{ gitea_mirror_default_interval }} +MIN_INTERVAL = {{ gitea_mirror_min_interval }} + [api] -ENABLE_SWAGGER = true -MAX_RESPONSE_ITEMS = 50 -DEFAULT_PAGING_NUM = 30 -DEFAULT_GIT_TREES_PER_PAGE = 1000 +{% if gitea_api_swagger_enabled | bool %} +ENABLE_SWAGGER = true +MAX_RESPONSE_ITEMS = 50 +DEFAULT_PAGING_NUM = {{ gitea_api_default_paging_num }} +DEFAULT_GIT_TREES_PER_PAGE = {{ gitea_api_default_git_trees_per_page }} +DEFAULT_MAX_BLOB_SIZE = 10485760 +{% else %} +ENABLE_SWAGGER = false +{% endif %} -[other] -SHOW_FOOTER_BRANDING = false -SHOW_FOOTER_VERSION = false -SHOW_FOOTER_TEMPLATE_LOAD_TIME = false - -[metrics] -ENABLED = false -TOKEN = - -{% if gitea_oauth_provider_enabled %} +{% if gitea_oauth_provider_enabled | bool %} [oauth2] -ENABLE = true -ACCESS_TOKEN_EXPIRATION_TIME = {{ gitea_access_token_expiration_time }} +ENABLE = true +ACCESS_TOKEN_EXPIRATION_TIME = {{ gitea_access_token_expiration_time }} REFRESH_TOKEN_EXPIRATION_TIME = {{ gitea_refresh_token_expiration_time }} -INVALIDATE_REFRESH_TOKENS = {{ gitea_invalidate_refresh_tokens }} -JWT_SECRET = {{ gitea_jwt_secret }} +INVALIDATE_REFRESH_TOKENS = {{ gitea_invalidate_refresh_tokens | bool | lower }} +JWT_SECRET = {{ gitea_jwt_secret }} {% else %} [oauth2] ENABLE = false {% endif %} + +[other] +SHOW_FOOTER_BRANDING = {{ gitea_show_footer_branding | bool }} +SHOW_FOOTER_VERSION = {{ gitea_show_footer_version | bool }} +SHOW_FOOTER_TEMPLATE_LOAD_TIME = {{ gitea_show_footer_template_load_time | bool }} + +[markup.asciidoc] +ENABLED = false +FILE_EXTENSIONS = .adoc,.asciidoc +RENDER_COMMAND = "asciidoc --out-file=- -" +IS_INPUT_FILE = false + +[metrics] +ENABLED = {{ gitea_metrics_enabled | bool }} +{% if gitea_metrics_token is defined and gitea_metrics_token %} +TOKEN = {{ gitea_metrics_token }} +{% endif %}