From d106a8279e7a849ef34cf058a9b9212e1bab2db6 Mon Sep 17 00:00:00 2001 From: Gregory Ballantine Date: Tue, 21 Mar 2023 13:31:08 -0400 Subject: [PATCH] Added ability to manage gitea configuration --- gitea/config/file.sls | 5 +++ gitea/defaults.yaml | 1 + gitea/files/app.ini.jinja | 91 +++++++++++++++++++++++++++++++++++++++ gitea/osfamilymap.yaml | 2 +- 4 files changed, 98 insertions(+), 1 deletion(-) create mode 100644 gitea/files/app.ini.jinja diff --git a/gitea/config/file.sls b/gitea/config/file.sls index ce1704d..fc54a75 100644 --- a/gitea/config/file.sls +++ b/gitea/config/file.sls @@ -14,5 +14,10 @@ gitea_config_file: - user: {{ gitea.config_owner }} - group: {{ gitea.config_group }} - mode: {{ gitea.config_mode }} + - source: 'salt://gitea/files/app.ini.jinja' + - template: 'jinja' + - makedirs: True + - context: + gitea: {{ gitea.config | json }} - require: - sls: {{ sls_package_install }} diff --git a/gitea/defaults.yaml b/gitea/defaults.yaml index c4afbae..fa10f0d 100644 --- a/gitea/defaults.yaml +++ b/gitea/defaults.yaml @@ -8,5 +8,6 @@ gitea: config_owner: 'gitea' config_group: 'gitea' config_mode: 0644 + config: {} service_name: 'gitea' service_enabled: True diff --git a/gitea/files/app.ini.jinja b/gitea/files/app.ini.jinja new file mode 100644 index 0000000..720d07f --- /dev/null +++ b/gitea/files/app.ini.jinja @@ -0,0 +1,91 @@ +# +# For information on the available settings, consult the online +# documentation, or see the accompanying file app.ini.defaults, which +# contains the settings incorporated into the gitea binary. +# +# This sample configuration runs Gitea with a local database. Before +# running this configuration, make sure to change the INTERNAL_TOKEN, +# JWT_SECRET, and SECRET_KEY variables. SECRET_KEY is a password of your +# choosing, INTERNAL_TOKEN is a 64-byte random number in BASE64 encoding, +# JWT_SECRET is a 32-byte random number in BASE64 encoding. +# +# You can generate the token using for example: +# openssl rand -base64 64 +# +# You can let Gitea add these to the config for you; you need to make +# app.ini writeable by the git user. +# +# There are no pre-configured users; the first user to register becomes an +# admin. In this sample configuration, the HTTP server only listens on +# localhost. +# +# If you'd rather use the web-based installer, remove this conf/app.ini file +# and make /usr/local/etc/gitea/conf writeable to the git user. + +APP_NAME = Gitea: Git with a cup of tea +RUN_USER = git +RUN_MODE = prod + +[database] +DB_TYPE = sqlite3 +HOST = 127.0.0.1:3306 +NAME = gitea +PASSWD = +PATH = /var/db/gitea/gitea.db +SSL_MODE = disable +USER = root + +[indexer] +ISSUE_INDEXER_PATH = /var/db/gitea/indexers/issues.bleve + +[log] +ROOT_PATH = /var/log/gitea +MODE = file +LEVEL = Info + +[mailer] +ENABLED = false + +[oauth2] +JWT_SECRET = D56bmu6xCtEKs9vKKgMKnsa4X9FDwo64HVyaS4fQ4mY + +[picture] +AVATAR_UPLOAD_PATH = /var/db/gitea/data/avatars +DISABLE_GRAVATAR = false +ENABLE_FEDERATED_AVATAR = false + +[repository] +ROOT = /var/db/gitea/gitea-repositories +# Gitea's default is 'bash', so if you have bash installed, you can comment +# this out. +SCRIPT_TYPE = sh + +[repository.upload] +TEMP_PATH = /var/db/gitea/data/tmp/uploads + +[security] +INSTALL_LOCK = true +INTERNAL_TOKEN = 1FFhAklka01JhgJTRUrFujWYiv4ijqcTIfXJ9o4n1fWxz+XVQdXhrqDTlsnD7fvz7gugdhgkx0FY2Lx6IBdPQw== +SECRET_KEY = ChangeMeBeforeRunning + +[session] +PROVIDER = file +PROVIDER_CONFIG = /var/db/gitea/data/sessions + +[server] +DOMAIN = localhost +HTTP_ADDR = 127.0.0.1 +HTTP_PORT = 3000 +ROOT_URL = http://localhost:3000/ +DISABLE_SSH = false +SSH_DOMAIN = %(DOMAIN)s +SSH_PORT = 22 +OFFLINE_MODE = false +APP_DATA_PATH = /var/db/gitea/data + +[service] +REGISTER_EMAIL_CONFIRM = false +ENABLE_NOTIFY_MAIL = false +DISABLE_REGISTRATION = false +ENABLE_CAPTCHA = true +REQUIRE_SIGNIN_VIEW = false diff --git a/gitea/osfamilymap.yaml b/gitea/osfamilymap.yaml index 6ee5c02..25be68d 100644 --- a/gitea/osfamilymap.yaml +++ b/gitea/osfamilymap.yaml @@ -2,4 +2,4 @@ # vim: ft=yaml FreeBSD: - config_path: '/usr/local/etc/gitea/app.ini' + config_path: '/usr/local/etc/gitea/conf/app.ini'