mirror of
https://github.com/YunoHost-Apps/ihatemoney_ynh.git
synced 2024-09-03 19:26:15 +02:00
[fix] Adapt to new ihatemoney settings behaviour
Since v1.0 ihatemoney reads its settings from /etc/ihatemoney/ihatemoney.cfg See https://github.com/spiral-project/ihatemoney/pull/193
This commit is contained in:
parent
daeb45bc40
commit
bb40c91db7
6 changed files with 23 additions and 14 deletions
|
@ -3,7 +3,7 @@
|
|||
nginx_conf_path="/etc/nginx/conf.d/${domain}.d/ihatemoney.conf"
|
||||
supervisor_conf_path="/etc/supervisor/conf.d/ihatemoney.conf"
|
||||
gunicorn_conf_path="/etc/ihatemoney/gunicorn.conf.py"
|
||||
ihatemoney_conf_path="/etc/ihatemoney/settings.py"
|
||||
ihatemoney_conf_path="/etc/ihatemoney/ihatemoney.cfg"
|
||||
INSTALL_DIR="/opt/yunohost/ihatemoney"
|
||||
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ mkdir ./conf
|
|||
ynh_backup "$nginx_conf_path" "conf/nginx.conf"
|
||||
ynh_backup "$gunicorn_conf_path" "conf/gunicorn.conf.py"
|
||||
ynh_backup "$supervisor_conf_path" "conf/supervisor.conf"
|
||||
ynh_backup "$ihatemoney_conf_path" "conf/settings.py"
|
||||
ynh_backup "$ihatemoney_conf_path" "conf/ihatemoney.cfg"
|
||||
|
||||
# Dump the database
|
||||
mysqldump -u "$dbuser" -p"$dbpass" --no-create-db "$dbname" > ./db.sql
|
||||
|
|
|
@ -83,17 +83,14 @@ sudo install -o root -g root -m 644 \
|
|||
sudo yunohost service add supervisor
|
||||
|
||||
# Configure ihatemoney
|
||||
sed -i "s@MY_SECRET_KEY@$secret_key@" ../conf/settings.py
|
||||
sed -i "s/MY_EMAIL/$mails_sender/" ../conf/settings.py
|
||||
sed -i "s@MY_MYSQL_PW@$db_pwd@" ../conf/settings.py
|
||||
sed -i "s@MY_PATH@$path@" ../conf/settings.py
|
||||
sed -i "s@MY_SECRET_KEY@$secret_key@" ../conf/ihatemoney.cfg
|
||||
sed -i "s/MY_EMAIL/$mails_sender/" ../conf/ihatemoney.cfg
|
||||
sed -i "s@MY_MYSQL_PW@$db_pwd@" ../conf/ihatemoney.cfg
|
||||
sed -i "s@MY_PATH@$path@" ../conf/ihatemoney.cfg
|
||||
# Remove the conf directive if served at root
|
||||
sed -i "/APPLICATION_ROOT='\/'/d" ../conf/settings.py
|
||||
sed -i "/APPLICATION_ROOT='\/'/d" ../conf/ihatemoney.cfg
|
||||
sudo install -o ihatemoney -g ihatemoney -m 640 \
|
||||
../conf/settings.py /etc/ihatemoney/settings.py
|
||||
# The settings have to be stored here (on python path)
|
||||
sudo ln -s /etc/ihatemoney/settings.py /opt/yunohost/ihatemoney/src/budget/settings.py
|
||||
|
||||
../conf/ihatemoney.cfg /etc/ihatemoney/ihatemoney.cfg
|
||||
|
||||
# If app is public, add url to SSOWat conf as skipped_uris
|
||||
if [[ "$is_public" -ne 0 ]];
|
||||
|
|
|
@ -64,7 +64,7 @@ create_system_dirs
|
|||
sudo cp -a "conf/nginx.conf" "$nginx_conf_path"
|
||||
sudo cp -a "conf/gunicorn.conf.py" "$gunicorn_conf_path"
|
||||
sudo cp -a "conf/supervisor.conf" "$supervisor_conf_path"
|
||||
sudo cp -a "conf/settings.py" "$ihatemoney_conf_path"
|
||||
sudo cp -a "conf/ihatemoney.cfg" "$ihatemoney_conf_path"
|
||||
|
||||
# Reload
|
||||
sudo systemctl reload nginx
|
||||
|
|
|
@ -46,8 +46,20 @@ sudo ${PIP} install -r ${NEW_REQUIREMENTS}
|
|||
sudo rm -rf ${INSTALL_DIR}/src
|
||||
sudo mv ${INSTALL_DIR}/src-new ${INSTALL_DIR}/src
|
||||
|
||||
# Re-create settings symlink
|
||||
sudo ln -s /etc/ihatemoney/settings.py ${INSTALL_DIR}/src/budget/settings.py
|
||||
|
||||
## Migration from old versions of the package
|
||||
|
||||
|
||||
if [ -e /etc/ihatemoney/settings.py ]; then
|
||||
# Strip out the no longer used part of the settings
|
||||
sudo python2 -c"d = open('/etc/ihatemoney/settings.py').read().replace('try:\n from settings import *\nexcept ImportError:\n pass\n', ''); open('/etc/ihatemoney/settings.py', 'w').write(d)"
|
||||
# Rename
|
||||
sudo mv /etc/ihatemoney/settings.py ${ihatemoney_conf_path}
|
||||
fi
|
||||
|
||||
# Remove no longer used symlink
|
||||
# (ihatemoney now read its conf by default from /etc/ihatemoney/ihatemoney.cfg)
|
||||
sudo rm -f ${INSTALL_DIR}/src/budget/settings.py
|
||||
|
||||
# Settings are not very likely to change, and that script may be
|
||||
# adapted to handle it in case.
|
||||
|
|
Loading…
Add table
Reference in a new issue