Gitea 配置修复

Signed-off-by: 萌森 <qyg2297248353@163.com>
This commit is contained in:
萌森 2024-07-18 11:22:42 +08:00
parent a1a451846f
commit 3205e0855d
4 changed files with 126 additions and 32 deletions

View File

@ -54,19 +54,21 @@ additionalProperties:
value: postgresql value: postgresql
- label: MySQL (MariaDB, Percona) - label: MySQL (MariaDB, Percona)
value: mysql value: mysql
- label: SQLite3 (忽略数据库配置)
value: sqlite3
- default: "127.0.0.1" - default: "127.0.0.1"
edit: true edit: true
envKey: DB_HOSTNAME envKey: DB_HOSTNAME
labelZh: 数据库 主机地址 labelZh: 数据库 主机地址
labelEn: Database Host labelEn: Database Host
required: true required: false
type: text type: text
- default: 5432 - default: 5432
edit: true edit: true
envKey: DB_PORT envKey: DB_PORT
labelZh: 数据库 端口 labelZh: 数据库 端口
labelEn: Database Port labelEn: Database Port
required: true required: false
rule: paramPort rule: paramPort
type: number type: number
- default: "gitea" - default: "gitea"
@ -74,7 +76,7 @@ additionalProperties:
envKey: DB_USER envKey: DB_USER
labelZh: 数据库 用户名 labelZh: 数据库 用户名
labelEn: Database User labelEn: Database User
required: true required: false
type: text type: text
- default: "" - default: ""
edit: true edit: true
@ -82,7 +84,7 @@ additionalProperties:
labelEn: Database Password labelEn: Database Password
labelZh: 数据库 密码 labelZh: 数据库 密码
random: true random: true
required: true required: false
rule: paramComplexity rule: paramComplexity
type: password type: password
- default: "gitea" - default: "gitea"
@ -90,7 +92,7 @@ additionalProperties:
envKey: DB_NAME envKey: DB_NAME
labelZh: 数据库 名称 labelZh: 数据库 名称
labelEn: Database Name labelEn: Database Name
required: true required: false
type: text type: text
- default: "Gitea" - default: "Gitea"
edit: true edit: true
@ -113,6 +115,14 @@ additionalProperties:
labelEn: SSH Clone Domain labelEn: SSH Clone Domain
required: true required: true
type: text type: text
- default: 22
edit: true
envKey: SSH_PORT
labelZh: SSH 克隆显示端口
labelEn: SSH Clone Display Port
required: true
rule: paramPort
type: number
- default: "" - default: ""
edit: true edit: true
envKey: ROOT_URL envKey: ROOT_URL
@ -172,15 +182,15 @@ additionalProperties:
- default: "" - default: ""
edit: true edit: true
envKey: SECRET_KEY envKey: SECRET_KEY
labelZh: 全局密钥 (覆盖级) labelZh: 全局加密密钥
labelEn: Global Secret Key (Override) labelEn: Global Secret Key
required: false required: false
type: text type: text
- default: "false" - default: "false"
edit: true edit: true
envKey: PROXY_ENABLED envKey: PROXY_ENABLED
labelZh: 启用代理 labelZh: 启用代理 (全局 + Webhook)
labelEn: Enable Proxy labelEn: Enable Proxy (Global + Webhook)
required: true required: true
type: select type: select
values: values:
@ -191,14 +201,75 @@ additionalProperties:
- default: "" - default: ""
edit: true edit: true
envKey: PROXY_URL envKey: PROXY_URL
labelZh: 代理服务器地址 labelZh: 代理服务器地址 (全局 + Webhook)
labelEn: Proxy Server URL labelEn: Proxy Server URL (Global + Webhook)
required: false required: false
type: text type: text
- default: "**" - default: "**"
edit: true edit: true
envKey: PROXY_HOSTS envKey: PROXY_HOSTS
labelZh: 代理网址 labelZh: 代理网址 (全局 + Webhook)
labelEn: Proxy Hosts labelEn: Proxy Hosts (Global + Webhook)
required: false
type: text
- default: "false"
edit: true
envKey: MAILER_ENABLED
labelZh: 启用邮件服务
labelEn: Enable Mailer Service
required: true
type: select
values:
- label: 开启
value: "true"
- label: 关闭
value: "false"
- default: "smtp"
edit: true
envKey: MAILER_PROTOCOL
labelZh: 邮件服务协议
labelEn: Mailer Protocol
required: false
type: text
- default: ""
edit: true
envKey: MAILER_SMTP_ADDR
labelZh: 邮件服务器地址
labelEn: Mailer Server Address
required: false
type: text
- default: 465
edit: true
envKey: MAILER_SMTP_PORT
labelZh: 邮件服务器端口
labelEn: Mailer Server Port
required: false
type: number
- default: ""
edit: true
envKey: MAILER_USER
labelZh: 邮件服务用户名
labelEn: Mailer Username
required: false
type: text
- default: ""
edit: true
envKey: MAILER_PASSWD
labelZh: 邮件服务密码
labelEn: Mailer Password
required: false
type: text
- default: ""
edit: true
envKey: MAILER_FROM
labelZh: 邮件服务发件人
labelEn: Mailer From
required: false
type: text
- default: "[Gitea]"
edit: true
envKey: MAILER_SUBJECT_PREFIX
labelZh: 邮件服务主题前缀
labelEn: Mailer Subject Prefix
required: false required: false
type: text type: text

View File

@ -27,11 +27,13 @@ services:
environment: environment:
- USER_UID=1000 - USER_UID=1000
- USER_GID=1000 - USER_GID=1000
- DB_HOST=${DB_HOSTNAME}:${DB_PORT} - DISABLE_SSH=false
- SSH_PORT=${PANEL_APP_PORT_SSH}
- GITEA__time__DEFAULT_UI_LOCATION=Asia/Shanghai
- GITEA__migrations__ALLOW_LOCALNETWORKS=true
- GITEA__api__ENABLE_SWAGGER=false - GITEA__api__ENABLE_SWAGGER=false
- GITEA__other__SHOW_FOOTER_POWERED_BY=false - DB_HOST=${DB_HOSTNAME}:${DB_PORT}
- GITEA__proxy__PROXY_ENABLED=${PROXY_ENABLED}
- GITEA__proxy__PROXY_URL=${PROXY_URL}
- GITEA__proxy__PROXY_HOSTS=${PROXY_HOSTS}
- GITEA__webhook__PROXY_URL=${PROXY_URL}
- GITEA__webhook__PROXY_HOSTS=${PROXY_HOSTS}
- GITEA__git.config__http.proxy=${PROXY_URL} - GITEA__git.config__http.proxy=${PROXY_URL}
- GITEA__git.config__https.proxy=${PROXY_URL} - GITEA__git.config__https.proxy=${PROXY_URL}

View File

@ -56,7 +56,7 @@ Gitea 提供多种语言界面,适应全球范围内的用户,促进了国
### 代理配置 ### 代理配置
开启 `启用代理` 配置后 开启 `启用代理` 配置后,同时生效与 `Gitea` 服务和 `Webhook` 服务和 `Git` 服务
+ `代理服务器地址` 填写代理服务器地址 + `代理服务器地址` 填写代理服务器地址
@ -68,10 +68,35 @@ Gitea 提供多种语言界面,适应全球范围内的用户,促进了国
使用 `**` 代表所有网址 使用 `**` 代表所有网址
例如需要代理: `Github` `gitlab` 例如需要代理: `Github` `gitlab`, 此项配置不作用于 `Git` 服务
```text ```text
*.github.com,*.gitlab.com github.com,*.github.com,*.gitlab.com
```
在 app.ini 配置文件中配置如下:
```ini
[webhook]
PROXY_URL = http://{host}:{port}
PROXY_HOSTS = github.com,*.github.com,*.gitlab.com
[proxy]
PROXY_ENABLED = true
PROXY_URL = http://{host}:{port}
PROXY_HOSTS = github.com,*.github.com,*.gitlab.com
```
### 开启 API 文档
默认关闭 `Swagger` 文档,开启后可以查看 `API` 文档
首次安装前,编辑`docker-compose.yml`修改环境变量 `GITEA__api__ENABLE_SWAGGER=false``true` 即可开启文档服务。
已安装用户,修改配置文件 `data/gitea/conf/app.ini``API` 配置项 `ENABLE_SWAGGER``true` 即可开启文档服务。
```ini
[api]
ENABLE_SWAGGER = true
``` ```
## 反向代理 ## 反向代理

View File

@ -19,22 +19,18 @@ INSTALL_LOCK=false
SECRET_KEY="" SECRET_KEY=""
DISABLE_REGISTRATION=false DISABLE_REGISTRATION=false
REQUIRE_SIGNIN_VIEW=false REQUIRE_SIGNIN_VIEW=false
DEFAULT_UI_LOCATION=Asia/Shanghai GITEA__time__DEFAULT_UI_LOCATION=Asia/Shanghai
ALLOW_LOCALNETWORKS=true GITEA__migrations__ALLOW_LOCALNETWORKS=true
ENABLE_SWAGGER=false GITEA__api__ENABLE_SWAGGER=false
GITEA__ui.meta__AUTHOR=新疆萌森软件开发工作室 GITEA__ui.meta__AUTHOR=新疆萌森软件开发工作室
GITEA__ui.meta__DESCRIPTION=轻量级代码托管解决方案,支持自建和托管服务。 GITEA__ui.meta__DESCRIPTION=轻量级代码托管解决方案,支持自建和托管服务。
GITEA__ui.meta__KEYWORDS=git,gitea,github,gitlab,gitee,code GITEA__ui.meta__KEYWORDS=git,gitea,github,gitlab,gitee,code
GITEA__security__LOGIN_REMEMBER_DAYS=3
GITEA__server__LOCAL_ROOT_URL=http://localhost:3000/ GITEA__server__LOCAL_ROOT_URL=http://localhost:3000/
GITEA__security__REVERSE_PROXY_TRUSTED_PROXIES=* GITEA__webhook__ALLOWED_HOST_LIST=*
GITEA__picture__REPOSITORY_AVATAR_FALLBACK=random GITEA__picture__REPOSITORY_AVATAR_FALLBACK=random
GITEA__attachment__MAX_SIZE=1024 GITEA__attachment__MAX_SIZE=1024
GITEA__git__MAX_GIT_DIFF_LINES=10000 GITEA__git__MAX_GIT_DIFF_LINES=10000
GITEA__git.timeout__DEFAULT=1800
GITEA__git.timeout__MIGRATE=1800
GITEA__git.timeout__MIRROR=1800
GITEA__git.timeout__CLONE=900
GITEA__git.timeout__GC=180
GITEA__git.config__http.postBuffer=2147483648 GITEA__git.config__http.postBuffer=2147483648
GITEA__git.config__core.compression=3 GITEA__git.config__core.compression=0
no_proxy=localhost,127.0.0.1,::1 GITEA__other__SHOW_FOOTER_POWERED_BY=false