diff --git a/conf/default.env b/conf/default.env index ae21afb..ec0f8fa 100644 --- a/conf/default.env +++ b/conf/default.env @@ -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 diff --git a/config_panel.toml b/config_panel.toml index ccf8c18..fdfd1e8 100644 --- a/config_panel.toml +++ b/config_panel.toml @@ -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." diff --git a/manifest.toml b/manifest.toml index ebaa328..a4adaa2 100644 --- a/manifest.toml +++ b/manifest.toml @@ -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 = "" diff --git a/scripts/install b/scripts/install index e0f69d6..0823878 100755 --- a/scripts/install +++ b/scripts/install @@ -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 diff --git a/scripts/upgrade b/scripts/upgrade index 7f5b0d1..02b8895 100755 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -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 #=================================================