1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/invoiceninja5_ynh.git synced 2024-09-03 19:26:23 +02:00

add config panel

This commit is contained in:
Éric Gaspar 2024-08-04 19:14:17 +02:00
parent 88a4426869
commit f96aa94dc7
5 changed files with 31 additions and 14 deletions

View file

@ -25,8 +25,8 @@ MAIL_PORT=25
MAIL_USERNAME=null
MAIL_PASSWORD=null
MAIL_ENCRYPTION=null
MAIL_FROM_ADDRESS=null
MAIL_FROM_NAME=null
MAIL_FROM_ADDRESS=__MAIL_ADDRESS__
MAIL_FROM_NAME=__MAIL_NAME__
DEMO_MODE=false

View file

@ -1,15 +1,17 @@
version = "1.0"
[main]
[main.config]
name = "Configuration"
name = "InvoicNinja configuration"
[main.config.MAIL_FROM_ADDRESS]
[main.config]
name = "Configuration Options"
[main.config.mail_address]
ask = "from email"
type = "email"
help = "Default email address to use for various automated emails."
bind = "MAIL_FROM_ADDRESS:__INSTALL_DIR__/.env"
[main.config.MAIL_FROM_NAME]
[main.config.mail_name]
ask = "from name"
type = "name"
help = "Default name address to use for various automated names."

View file

@ -53,14 +53,14 @@ ram.runtime = "50M"
help.fr = "Le mot de passe pour se connecter à InvoiceNinja."
type = "password"
[install.MAIL_FROM_NAME]
[install.mail_name]
help.en = "Choose what name will be displayed when InvoiceNinja sends mails."
help.fr = ""
type = "string"
default = ""
[install.MAIL_FROM_ADDRESS]
help.en = "Choose from which mail-address mails will be send."
[install.mail_address]
help.en = "Choose from which mail-address emails will be send."
help.fr = ""
type = "email"
default = ""

View file

@ -16,10 +16,8 @@ source /usr/share/yunohost/helpers
api_secret="$(ynh_string_random --length=32)"
app_key="$(ynh_string_random --length=32)"
phantomjs_key="$(ynh_string_random --length=32)"
ynh_app_setting_set --app="$app" --key=MAIL_FROM_ADDRESS --value="$MAIL_FROM_ADDRESS"
ynh_app_setting_set --app="$app" --key=MAIL_FROM_NAME --value="$MAIL_FROM_NAME"
mail_address=$(ynh_app_setting_get --app=$mail_adress --key=smail_address)
mail_name=$(ynh_app_setting_get --app=$mail_adress --key=mail_name)
#=================================================
# STORE KEYS TO APP SETTINGS
@ -29,6 +27,8 @@ ynh_script_progression --message="Storing secrets to app settings..."
ynh_app_setting_set --app=$app --key=api_secret --value=$api_secret
ynh_app_setting_set --app=$app --key=app_key --value=$app_key
ynh_app_setting_set --app=$app --key=phantomjs_key --value=$phantomjs_key
ynh_app_setting_set --app="$app" --key=mail_address --value="$mail_address"
ynh_app_setting_set --app="$app" --key=mail_name --value="$mail_name"
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
@ -70,7 +70,7 @@ ynh_script_progression --message="Building the application..." --weight=1
pushd "$install_dir"
# Run the database migrations and initially fill the db
php$phpversion artisan migrate:fresh --seed --no-interaction --verbose --force
php$phpversion artisan ninja:create-account --email $MAIL_FROM_ADDRESS --password "$password" --no-interaction --verbose
php$phpversion artisan ninja:create-account --email $mail_address --password "$password" --no-interaction --verbose
php$phpversion artisan optimize --no-interaction --verbose
php$phpversion artisan view:clear
php$phpversion artisan cache:clear

View file

@ -15,6 +15,21 @@ source /usr/share/yunohost/helpers
upgrade_type=$(ynh_check_app_version_changed)
#=================================================
# ENSURE DOWNWARD COMPATIBILITY
#=================================================
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
if [ -z "${mail_address:-}" ]; then
mail_address="true"
ynh_app_setting_set --app=$app --key=mail_address --value=$mail_address
fi
if [ -z "${mail_name:-}" ]; then
mail_name="true"
ynh_app_setting_set --app=$app --key=mail_name --value=$mail_name
fi
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================