YunoHost-Apps / matomo_ynh

Matomo package for YunoHost
https://matomo.org/
GNU General Public License v3.0
18 stars 6 forks source link

Change url: Update trusted hosts #119

Closed CodeShakingSheep closed 5 months ago

CodeShakingSheep commented 7 months ago

Problem

Recently, I changed the URL of my Matomo app. Afterwards the new URL hadn't been added to trusted_hosts. See FAQ here: https://matomo.org/faq/how-to-install/faq_18/  Same as here: Fix https://github.com/YunoHost-Apps/matomo_ynh/issues/114

Solution

So, I just updated trusted_hosts[] value in config/config.ini-php with the new URL.

PR Status

Automatic tests

Automatic tests can be triggered on https://ci-apps-dev.yunohost.org/ after creating the PR, by commenting "!testme", "!gogogadgetoci" or "By the power of systemd, I invoke The Great App CI to test this Pull Request!". (N.B. : for this to work you need to be a member of the Yunohost-Apps organization)

CodeShakingSheep commented 7 months ago

!testme

yunohost-bot commented 7 months ago

:v: Test Badge

yunohost-bot commented 7 months ago

:books: :worm: Test Badge

CodeShakingSheep commented 7 months ago

Apparently there is an issue with the internal sed command used by ynh_replace_string. Here is the relevant log part:

3746 INFO INFO - [########++++++......] > Reconfiguring Matomo...
3747 INFO DEBUG - + ynh_replace_string '--match_string=trusted_hosts[] = "sub.domain.tld"' '--replace_string=trusted_hosts[] = "sub.domain.tld"' --target_file=/var/www/matomo/config/config.ini.php
3747 INFO DEBUG - + sed --in-place 'strusted_hosts[] = "sub.domain.tld"trusted_hosts[] = "sub.domain.tld"g' /var/www/matomo/config/config.ini.php
3747 INFO WARNING - sed: -e expression #1, char 73: unterminated `s' command
3747 INFO DEBUG - + ynh_exit_properly

This is the command I used:

ynh_replace_string --match_string="trusted_hosts[] = \"$old_domain\"" --replace_string="trusted_hosts[] = \"$new_domain\"" --target_file="$install_dir/config/config.ini.php"

I thought, I had to escape the quotes but may be there is something wrong with it? Any idea @ericgaspar @alexAubin ?

ericgaspar commented 7 months ago

!testme

yunohost-bot commented 7 months ago

:rocket: Test Badge

yunohost-bot commented 7 months ago

:worm: Test Badge

CodeShakingSheep commented 6 months ago

!testme

yunohost-bot commented 6 months ago

:sunflower: Test Badge

yunohost-bot commented 6 months ago

:bug: Test Badge

CodeShakingSheep commented 6 months ago

4190 INFO WARNING - sed: can't read /var/www/matomo/config/config.ini.php: No such file or directory

Related to this: https://github.com/YunoHost-Apps/matomo_ynh/blob/master/scripts/upgrade#L26 ?

# config.ini.php is only created during the post-install process...
# it is therefore not present when the CI tests are carried out...
# This condition is only for CI test to go through the upgrade process

What do you think @Tagadda @ericgaspar ?

CodeShakingSheep commented 5 months ago

!testme

yunohost-bot commented 5 months ago

:v: Test Badge

yunohost-bot commented 5 months ago

:worm: Test Badge

CodeShakingSheep commented 5 months ago

!testme

yunohost-bot commented 5 months ago

:book: Test Badge