Browse Source

new: [gitea] allow to provide all ``app.ini`` settings through ``options``

odoo_fix_webhook_url
Valentin Lab 11 months ago
parent
commit
b20cea0cd3
  1. 28
      gitea/README.org
  2. 4
      gitea/hooks/init
  3. 40
      gitea/lib/common
  4. 17
      gitea/metadata.yml

28
gitea/README.org

@ -0,0 +1,28 @@
# -*- ispell-local-dictionary: "english" -*-
#+SETUPFILE: ~/.emacs.d/etc/setup/default.setup
#+SETUPFILE: ~/.emacs.d/etc/setup/latex.setup
#+SETUPFILE: ~/.emacs.d/etc/setup/html-readtheorg-local.setup
#+TITLE: Gitea
* Usage
#+begin_src yaml
gitea:
charm: gitea
options:
config: ## this entry is merged in app.ini
#app-name: "Gitea: Git with a cup of tea"
service:
#disable_registration: false
#require-signin-view: false
#register-email-confirm: false
#enable-notify-mail: false
#allow-only-external-registration: false
#enable-captcha: false
#default-keep-email-private: false
#default-allow-create-organization: true
#default-enable-timetracking: true
#no-reply-address: noreply.example.org
#+end_src

4
gitea/hooks/init

@ -99,3 +99,7 @@ ENABLE_OPENID_SIGNIN = false
ENABLE_OPENID_SIGNUP = false
EOF
config=$(options-get config 2>/dev/null ) || true
ini=$(e "$config" | gitea:ini-make ) || exit 1
e "$ini" | ini merge || exit 1

40
gitea/lib/common

@ -19,4 +19,42 @@ $MASTER_BASE_SERVICE_NAME:
- compose.config_hash=$config_hash
"
}
}
join_by_dot() {
local IFS="."
echo "$*"
}
gitea:ini-make() {
local key val type
local sep=
[ -n "$1" ] && printf "\n[%s]\n" "$(IFS="."; echo "$*")"
while read-0 key type val; do
case "${type##*\!}" in
map|seq)
e "$val" | gitea:ini-make "$@" "$key" || return 1
continue
;;
bool)
val="${val%$'\n'}"
case "${val,,}" in
true|ok|yes|y)
val=true
;;
false|ko|nok|no|n)
val=false
;;
*)
die "Invalid value for ${WHITE}$key$NORMAL, please use a boolean value."
;;
esac
;;
str|*)
val="${val%$'\n'}"
;;
esac
key=${key//-/_}
key=${key^^}
printf "%s = %s\n" "$key" "$val"
done < <( yq -0 'to_entries | map([.key, .value | type, .value | to_yaml])[] | .[]' )
}

17
gitea/metadata.yml

@ -12,8 +12,21 @@ docker-compose:
data-resources:
- /data
# default-options:
# config: |
default-options:
config:
#app-name: "Gitea: Git with a cup of tea"
service:
#disable_registration: false
#require-signin-view: false
#register-email-confirm: false
#enable-notify-mail: false
#allow-only-external-registration: false
#enable-captcha: false
#default-keep-email-private: false
#default-allow-create-organization: true
#default-enable-timetracking: true
#no-reply-address: noreply.example.org
provides:
vcs-manager:

Loading…
Cancel
Save