mirror of
https://github.com/YunoHost-Apps/woodpecker_ynh.git
synced 2024-09-03 20:35:57 +02:00
Add forge configuration code
This commit is contained in:
parent
78674d286a
commit
25019eb468
4 changed files with 47 additions and 7 deletions
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
# Enable pretty-printed debug output.
|
# Enable pretty-printed debug output.
|
||||||
# Default: false
|
# Default: false
|
||||||
#WOODPECKER_DEBUG_PRETTY=
|
WOODPECKER_DEBUG_PRETTY=true
|
||||||
|
|
||||||
# Disable colored debug output.
|
# Disable colored debug output.
|
||||||
# Default: true
|
# Default: true
|
||||||
|
@ -144,3 +144,10 @@ WOODPECKER_DATABASE_DATASOURCE=postgres://__DB_USER__:__DB_PWD__@localhost:5432/
|
||||||
# Default: empty
|
# Default: empty
|
||||||
# Example: WOODPECKER_LIMIT_CPU_SET=1,2
|
# Example: WOODPECKER_LIMIT_CPU_SET=1,2
|
||||||
#WOODPECKER_LIMIT_CPU_SET=
|
#WOODPECKER_LIMIT_CPU_SET=
|
||||||
|
|
||||||
|
|
||||||
|
## Forge configuration from yunohost
|
||||||
|
__CONFIG_FORGE_TYPE__
|
||||||
|
__CONFIG_FORGE_URL__
|
||||||
|
__CONFIG_FORGE_CLIENT__
|
||||||
|
__CONFIG_FORGE_SECRET__
|
||||||
|
|
|
@ -45,12 +45,31 @@ ram.runtime = "200M"
|
||||||
type = "group"
|
type = "group"
|
||||||
default = "visitors"
|
default = "visitors"
|
||||||
|
|
||||||
# [install.language]
|
[install.forge_type]
|
||||||
# ask.en = "Choose the application language"
|
ask.en = "Select the kind of forge you're connecting Woodpecker to"
|
||||||
# ask.fr = "Choisissez la langue de l'application"
|
ask.fr = "Sélectionnez le type de forge à laquelle vous connectez Woodpecker"
|
||||||
# type = "select"
|
type = "select"
|
||||||
# choices = ["fr", "en"]
|
choices.github = "Github"
|
||||||
# default = "fr"
|
choices.gitlab = "Gitlab"
|
||||||
|
choices.gitea = "Gitea / Forgejo"
|
||||||
|
choices.bitbucket = "Bitbucket"
|
||||||
|
|
||||||
|
[install.forge_url]
|
||||||
|
ask.en = "Provide the forge URL"
|
||||||
|
ask.fr = "Entrez l'URL de la forge"
|
||||||
|
type = "string"
|
||||||
|
help.en = "Useless for Bitbucket and Github.com."
|
||||||
|
help.fr = "Inutile pour Bitbucket et Github.com."
|
||||||
|
|
||||||
|
[install.forge_client]
|
||||||
|
ask.en = "Provide the forge OAuth Client ID"
|
||||||
|
ask.fr = "Entrez l'ID de client OAuth de la forge"
|
||||||
|
type = "string"
|
||||||
|
|
||||||
|
[install.forge_secret]
|
||||||
|
ask.en = "Provide the forge OAuth secret"
|
||||||
|
ask.fr = "Entrez le secret OAuth de la forge"
|
||||||
|
type = "string"
|
||||||
|
|
||||||
# [install.admin]
|
# [install.admin]
|
||||||
# type = "user"
|
# type = "user"
|
||||||
|
|
|
@ -8,6 +8,19 @@
|
||||||
# PERSONAL HELPERS
|
# PERSONAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
|
_woodpecker_set_forge_config() {
|
||||||
|
FORGE=$(printf '%s\n' "$forge_type" | awk '{ print toupper($0) }')
|
||||||
|
config_forge_type="WOODPECKER_${FORGE}=true"
|
||||||
|
config_forge_client="WOODPECKER_${FORGE}_CLIENT=$forge_client"
|
||||||
|
config_forge_secret="WOODPECKER_${FORGE}_SECRET=$forge_secret"
|
||||||
|
|
||||||
|
if [[ -n "$forge_url" ]]; then
|
||||||
|
config_forge_url="WOODPECKER_${FORGE}_URL=$forge_url"
|
||||||
|
else
|
||||||
|
config_forge_url="# no forge url"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# EXPERIMENTAL HELPERS
|
# EXPERIMENTAL HELPERS
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -70,6 +70,7 @@ ynh_use_logrotate
|
||||||
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
ynh_script_progression --message="Adding a configuration file..." --weight=1
|
||||||
|
|
||||||
path_no_trailing_slash=${path%/}
|
path_no_trailing_slash=${path%/}
|
||||||
|
_woodpecker_set_forge_config
|
||||||
|
|
||||||
ynh_add_config --template="woodpecker-server.conf" --destination="$install_dir/woodpecker-server.conf"
|
ynh_add_config --template="woodpecker-server.conf" --destination="$install_dir/woodpecker-server.conf"
|
||||||
# chmod 400 "$install_dir/some_config_file"
|
# chmod 400 "$install_dir/some_config_file"
|
||||||
|
|
Loading…
Add table
Reference in a new issue