From 32a1532f7a12c9e2bd6b6230115406693391de56 Mon Sep 17 00:00:00 2001 From: L3D Date: Sun, 21 Mar 2021 17:42:28 +0100 Subject: [PATCH] reorder gitea database config --- README.md | 17 +++++++++-------- defaults/main.yml | 16 ++++++++-------- templates/gitea.ini.j2 | 14 ++++++-------- 3 files changed, 23 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 0e11f33..9fd6092 100644 --- a/README.md +++ b/README.md @@ -117,6 +117,15 @@ Here is a deeper insight into the variables of this gitea role. For the exact fu ### Database ([database](https://docs.gitea.io/en-us/config-cheat-sheet/#database-database)) | variable name | default value | description | | ------------- | ------------- | ----------- | +| `gitea_db_type` | `sqlite3` | The database type in use `[mysql, postgres, mssql, sqlite3]`. | +| `gitea_db_host` | `127.0.0.0:3306` | Database host address and port or absolute path for unix socket [mysql, postgres] (ex: `/var/run/mysqld/mysqld.sock`). | +| `gitea_db_name` | `root` | Database name | +| `gitea_db_user` | `gitea` | Database username | +| `gitea_db_password` | `lel` | Database password. **PLEASE CHANGE** | +| `gitea_db_ssl` | `disable` | Configure SSL only if your database type supports it. Have a look into the [config-cheat-sheet](https://docs.gitea.io/en-us/config-cheat-sheet/#database-database) for more detailed information | +| `gitea_db_path` | `{{ gitea_home }}/data/gitea.db` | DB path, if you use `sqlite3`. | +| `gitea_database_extra_config` | `''` | you can use this variable to pass additional config parameters in the `[ui]` section of the config. | + @@ -152,14 +161,6 @@ Here is a deeper insight into the variables of this gitea role. For the exact fu ### Database configuration -* `gitea_db_type`: Database type, can be `mysql`, `postgres` or `sqlite3` -* `gitea_db_host`: Database host string `host:port` or `/run/postgresql/` when connectiong to postgres via local unix socket (peer authentication) -* `gitea_db_name`: Database name -* `gitea_db_user`: Database username -* `gitea_db_password`: Database password -* `gitea_db_ssl`: Use SSL ? (postgres only!). Can be `require`, `disable`, `verify-ca` or `verify-full` -* `gitea_db_path`: DB path, if you use `sqlite3`. The default is good enough to work though. - ### Mailer configuration * `gitea_mailer_enabled`: Whether to enable the mailer. Default: `false` diff --git a/defaults/main.yml b/defaults/main.yml index b233e45..d38d701 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -52,6 +52,14 @@ gitea_server_extra_config: '' # Database (database) # -> https://docs.gitea.io/en-us/config-cheat-sheet/#database-database +gitea_db_type: 'sqlite3' +gitea_db_host: '127.0.0.0:3306' +gitea_db_name: 'root' +gitea_db_user: 'gitea' +gitea_db_password: 'lel' +gitea_db_ssl: 'disable' +gitea_db_path: "{{ gitea_home }}/data/gitea.db" + # look and feel gitea_disable_gravatar: true @@ -76,14 +84,6 @@ gitea_oauth2_jwt_secret: '' gitea_systemd_cap_net_bind_service: false -gitea_db_type: sqlite3 -gitea_db_host: 127.0.0.0:3306 -gitea_db_name: root -gitea_db_user: gitea -gitea_db_password: lel -gitea_db_ssl: disable -gitea_db_path: "{{ gitea_home }}/data/gitea.db" - gitea_mailer_enabled: false diff --git a/templates/gitea.ini.j2 b/templates/gitea.ini.j2 index e0792af..77a9b0f 100644 --- a/templates/gitea.ini.j2 +++ b/templates/gitea.ini.j2 @@ -60,22 +60,20 @@ LFS_JWT_SECRET = {{ gitea_lfs_jwt_secret }} ; ; -> https://docs.gitea.io/en-us/config-cheat-sheet/#database-database [database] -; Either "mysql", "postgres", "mssql" or "sqlite3", it's your choice DB_TYPE = {{ gitea_db_type }} HOST = {{ gitea_db_host }} NAME = {{ gitea_db_name }} USER = {{ gitea_db_user }} -; Use PASSWD = `your password` for quoting if you use special characters in the password. PASSWD = {{ gitea_db_password }} -; For Postgres, either "disable" (default), "require", "verify-ca" or "verify-full" -; For MySQL, either "false" (default), "true", or "skip-verify" SSL_MODE = {{ gitea_db_ssl }} -; For "sqlite3" and "tidb", use an absolute path when you start gitea as service -PATH = {{ gitea_db_path }} +PATH = {{ gitea_db_path }} {% if gitea_log_only_warning %} -LOG_SQL = false +LOG_SQL = false {% endif %} - +{{ gitea_database_extra_config }} +; +; +; -> https://docs.gitea.io/en-us/config-cheat-sheet/#indexer-indexer [indexer] ; Issue indexer storage path, available when ISSUE_INDEXER_TYPE is bleve ISSUE_INDEXER_PATH = {{ gitea_home }}/indexers/issues.bleve