#!/bin/bash

# causes the shell to exit if any subcommand or pipeline returns a non-zero status
set -e

# Source YNH helpers
. /usr/share/yunohost/helpers

# Get app instance name
app=$YNH_APP_INSTANCE_NAME

# Retrieve arguments
domain=$(sudo yunohost app setting $app domain)
path=$(sudo yunohost app setting $app path)
public_site=$(sudo yunohost app setting $app public_site)

# Copy the app files
ynh_backup "/var/www/$app" "sources"

# Copy the conf files
ynh_backup "/etc/nginx/conf.d/$domain.d/$app.conf" "conf/nginx.conf"
