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:
parent
3b75f53b0e
commit
2fe22d9d44
2 changed files with 13 additions and 7 deletions
|
@ -7,12 +7,12 @@ name.fr = "Information à propos de votre propre code"
|
||||||
[main.custom_code]
|
[main.custom_code]
|
||||||
[main.custom_code.main_folder]
|
[main.custom_code.main_folder]
|
||||||
ask = "Name of your app's main folder"
|
ask = "Name of your app's main folder"
|
||||||
type = "string"
|
type = "path"
|
||||||
default = "FastAPIAppFolder"
|
default = "FastAPIAppFolder"
|
||||||
help = "It's the folder containing the object 'app' in __init__.py"
|
help = "It's the folder containing the object 'app' in __init__.py"
|
||||||
|
|
||||||
[main.custom_code.requirements]
|
[main.custom_code.requirements_path]
|
||||||
ask = "Do you have a custom requirement.txt"
|
ask = "path to your requirements.txt file"
|
||||||
type = "boolean"
|
type = "path"
|
||||||
optional = true
|
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"
|
||||||
|
|
|
@ -45,6 +45,9 @@ ynh_app_config_apply() {
|
||||||
chpasswd <<< "${app}:${password}"
|
chpasswd <<< "${app}:${password}"
|
||||||
fi
|
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
|
# Symbolic link to main app folder
|
||||||
if [ ! "$main_folder" == "FastAPIAppFolder" ]
|
if [ ! "$main_folder" == "FastAPIAppFolder" ]
|
||||||
then
|
then
|
||||||
|
@ -54,15 +57,18 @@ ynh_app_config_apply() {
|
||||||
ln -s "$data_dir/$main_folder" "$data_dir/FastAPIAppFolder"
|
ln -s "$data_dir/$main_folder" "$data_dir/FastAPIAppFolder"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $requirements == 1 ]
|
if [ ! "$requirements_path" == "" ]
|
||||||
then
|
then
|
||||||
ynh_print_info --message="Installing python custom requirements"
|
ynh_print_info --message="Installing python custom requirements"
|
||||||
# Enable python virtual environnement
|
# Enable python virtual environnement
|
||||||
source $install_dir/venv/bin/activate
|
source $install_dir/venv/bin/activate
|
||||||
|
|
||||||
# Install user's custom requirements
|
# Install user's custom requirements
|
||||||
pip install -r $data_dir/requirements.txt
|
pip install -r $data_dir/$requirements_path
|
||||||
fi
|
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
|
ynh_app_config_run $1
|
||||||
|
|
Loading…
Reference in a new issue