diff --git a/README.md b/README.md index f389dc0..b8e1169 100644 --- a/README.md +++ b/README.md @@ -96,14 +96,35 @@ Either you define exactly which release you install. Or you use the option ``lat | `gitea_repo_merges` | *(see defaults)* | Sign merges. | | `gitea_enable_repo_signing_extra` | | you can use this variable to pass additional config parameters in the `[repository.signing]` section of the config. | +### CORS ([cors](https://docs.gitea.io/en-us/config-cheat-sheet/#cors-cors)) +| ------------- | ------------- | ----------- | +| `gitea_enable_cors` | `false` | enable cors headers (disabled by default) | +| `gitea_cors_scheme` | `http` | scheme of allowed requests | +| `gitea_cors_allow_domain` | `*` | list of requesting domains that are allowed | +| `gitea_cors_allow_subdomain` | `false` |allow subdomains of headers listed above to request | +| `gitea_cors_methods` | *(see defaults)* | list of methods allowed to request | +| `gitea_cors_max_age` | `10m` | max time to cache response | +| `gitea_cors_allow_credentials` | `false` | allow request with credentials | +| `gitea_cors_headers` | `Content-Type,User-Agent` | additional headers that are permitted in requests | +| `gitea_cors_x_frame_options` | `SAMEORIGIN` | Set the `X-Frame-Options` header value. | +| `gitea_cors_extra` | | you can use this variable to pass additional config parameters in the `[cors]` section of the config. | + ### UI ([ui](https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui)) | variable name | default value | description | | ------------- | ------------- | ----------- | | `gitea_show_user_email` | `false` | Do you want to display email addresses ? (true/false) | -| `gitea_theme_default` | `gitea` | Default theme | -| `gitea_themes` | `gitea,arc-green` | List of enabled themes | +| `gitea_theme_default` | `auto` | Default theme | +| `gitea_themes` | `auto,gitea,arc-green` | List of enabled themes | | `gitea_ui_extra_config` | `''` | you can use this variable to pass additional config parameters in the `[ui]` section of the config. | +### UI - Meta ([ui.meta](https://docs.gitea.io/en-us/config-cheat-sheet/#ui---metadata-uimeta)) +| variable name | default value | description | +| ------------- | ------------- | ----------- | +| `gitea_ui_author` | *(see defaults)* | Author meta tag of the homepage. | +| `gitea_ui_description` | *(see defaults)* | Description meta tag of the homepage. | +| `gitea_ui_keywords` | *(see defaults)* | Keywords meta tag of the homepage | +| `gitea_ui_meta_extra_config` | | you can use this variable to pass additional config parameters in the `[ui.meta]` section of the config. | + ### Server ([server](https://docs.gitea.io/en-us/config-cheat-sheet/#server-server)) | variable name | default value | description | | ------------- | ------------- | ----------- | diff --git a/defaults/main.yml b/defaults/main.yml index 22b5778..9dfcccf 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -55,13 +55,33 @@ gitea_repo_crud_actions: 'pubkey, twofa, parentsigned' gitea_repo_merges: ' pubkey, twofa, basesigned, commitssigned' gitea_enable_repo_signing_extra: '' +# CORS (cors) +# -> https://docs.gitea.io/en-us/config-cheat-sheet/#cors-cors +gitea_enable_cors: false +gitea_cors_scheme: 'http' +gitea_cors_allow_domain: '*' +gitea_cors_allow_subdomain: false +gitea_cors_methods: 'GET,HEAD,POST,PUT,PATCH,DELETE,OPTIONS' +gitea_cors_max_age: '10m' +gitea_cors_allow_credentials: false +gitea_cors_headers: 'Content-Type,User-Agent' +gitea_cors_x_frame_options: 'SAMEORIGIN' +gitea_cors_extra: '' + # UI (ui) # -> https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui gitea_show_user_email: false -gitea_theme_default: 'gitea' -gitea_themes: 'gitea,arc-green' +gitea_theme_default: 'auto' +gitea_themes: 'auto,gitea,arc-green' gitea_ui_extra_config: '' +# UI - Metadata (ui.meta) +# -> https://docs.gitea.io/en-us/config-cheat-sheet/#ui---metadata-uimeta +gitea_ui_author: 'Gitea - Git with a cup of tea' +gitea_ui_description: 'Gitea (Git with a cup of tea) is a painless self-hosted Git service written in Go:' +gitea_ui_keywords: 'go,git,self-hosted,gitea,forgejo' +gitea_ui_meta_extra_config: '' + # Server (server) # -> https://docs.gitea.io/en-us/config-cheat-sheet/#server-server gitea_protocol: 'http' diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index a6055ff..58cab05 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -33,24 +33,45 @@ TEMP_PATH = {{ gitea_home }}/data/tmp/uploads ;{% if gitea_enable_repo_signing_options | bool %} ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#repository---signing-repositorysigning [repository.signing] -SIGNING_KEY = {{ gitea_repo_signing_key }} -SIGNING_NAME = {{ gitea_repo_signing_name }} -SIGNING_EMAIL = {{ gitea_repo_signing_email }} -INITIAL_COMMIT = {{ gitea_repo_initial_commit }} +SIGNING_KEY = {{ gitea_repo_signing_key }} +SIGNING_NAME = {{ gitea_repo_signing_name }} +SIGNING_EMAIL = {{ gitea_repo_signing_email }} +INITIAL_COMMIT = {{ gitea_repo_initial_commit }} DEFAULT_TRUST_MODEL = {{ gitea_repo_default_trust_model }} -WIKI = {{ gitea_repo_wiki }} -CRUD_ACTIONS = {{ gitea_repo_crud_actions }} -MERGES = {{ gitea_repo_merges }} +WIKI = {{ gitea_repo_wiki }} +CRUD_ACTIONS = {{ gitea_repo_crud_actions }} +MERGES = {{ gitea_repo_merges }} {% if gitea_enable_repo_signing_extra != '' %}{{ gitea_enable_repo_signing_extra }}{% else %};{% endif %} ;{% endif %} ; +;{% if gitea_enable_cors | bool %} +; -> https://docs.gitea.io/en-us/config-cheat-sheet/#cors-cors +[cors] +ENABLED = {{ gitea_enable_cors | ternary('true', 'false') }} +SCHEME = {{ gitea_cors_scheme }} +ALLOW_DOMAIN = {{ gitea_cors_allow_domain }} +ALLOW_SUBDOMAIN = {{ gitea_cors_allow_subdomain | ternary('true', 'false') }} +METHODS = {{ gitea_cors_methods }} +MAX_AGE = {{ gitea_cors_max_age }} +ALLOW_CREDENTIALS = {{ gitea_cors_allow_credentials | ternary('true', 'false') }} +HEADERS = {{ gitea_cors_headers }} +X_FRAME_OPTIONS = {{ gitea_cors_x_frame_options }} +{% if gitea_cors_extra != '' %}{{ gitea_cors_extra }}{% else %};{% endif %} +;{% endif %} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#ui-ui [ui] SHOW_USER_EMAIL = {{ gitea_show_user_email | ternary('true', 'false') }} DEFAULT_THEME = {{ gitea_theme_default }} THEMES = {{ gitea_themes }} -{{ gitea_ui_extra_config }} +{% if gitea_ui_extra_config != '' %}{{ gitea_ui_extra_config }}{% else %};{% endif %} +; +; +[ui.meta] +AUTHOR = {{ gitea_ui_author }} +DESCRIPTION = {{ gitea_ui_description }} +KEYWORDS = {{ gitea_ui_keywords }} +{% if gitea_ui_meta_extra_config != '' %}{{ gitea_ui_meta_extra_config }}{% else %};{% endif %} ; ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#server-server