diff --git a/config_panel.toml b/config_panel.toml index 24cbbc1..f129352 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -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" diff --git a/scripts/config b/scripts/config index 78bcbf3..0bffb37 100644 --- a/scripts/config +++ b/scripts/config @@ -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