1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/FastAPI_ynh.git synced 2024-09-03 18:36:00 +02:00

changement de programme pour la config

This commit is contained in:
leonard 2023-12-08 13:47:47 +01:00
parent 3b75f53b0e
commit 2fe22d9d44
2 changed files with 13 additions and 7 deletions

View file

@ -7,12 +7,12 @@ name.fr = "Information à propos de votre propre code"
[main.custom_code]
[main.custom_code.main_folder]
ask = "Name of your app's main folder"
type = "string"
type = "path"
default = "FastAPIAppFolder"
help = "It's the folder containing the object 'app' in __init__.py"
[main.custom_code.requirements]
ask = "Do you have a custom requirement.txt"
type = "boolean"
[main.custom_code.requirements_path]
ask = "path to your requirements.txt file"
type = "path"
optional = true
help = "Check it if you want my_FastAPI_app to install your custom python dependencies."
help = "Relative path to your requirement file, including it's name"

View file

@ -45,6 +45,9 @@ ynh_app_config_apply() {
chpasswd <<< "${app}:${password}"
fi
ynh_script_progression --message="Stopping a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app/$app.log"
# Symbolic link to main app folder
if [ ! "$main_folder" == "FastAPIAppFolder" ]
then
@ -54,15 +57,18 @@ ynh_app_config_apply() {
ln -s "$data_dir/$main_folder" "$data_dir/FastAPIAppFolder"
fi
if [ $requirements == 1 ]
if [ ! "$requirements_path" == "" ]
then
ynh_print_info --message="Installing python custom requirements"
# Enable python virtual environnement
source $install_dir/venv/bin/activate
# Install user's custom requirements
pip install -r $data_dir/requirements.txt
pip install -r $data_dir/$requirements_path
fi
ynh_script_progression --message="Starting a systemd service..." --weight=1
ynh_systemd_action --service_name=$app --action="start" --log_path="/var/log/$app/$app.log"
}
ynh_app_config_run $1