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

Replace db.inc.php with .env

This commit is contained in:
Salamandar 2024-07-10 09:57:47 +02:00
parent 7271310c5c
commit f5d1759430
5 changed files with 26 additions and 27 deletions

View file

@ -1,17 +0,0 @@
<?php
# This is the database configuration of Movim
# You need to copy an rename this file to 'db.inc.php' and complete the values
$conf = [
# The type can be 'pgsql' or 'mysql'
'type' => 'pgsql',
# The database username
'username' => '__DB_USER__',
# The password
'password' => '__DB_PWD__',
# Where can we find the database ?
'host' => 'localhost',
# The port number, 3306 for MySQL and 5432 for PostgreSQL
'port' => 5432,
# The database name
'database' => '__DB_NAME__'
];

14
conf/dot_env Normal file
View file

@ -0,0 +1,14 @@
# Database configuration
DB_DRIVER=pgsql
DB_HOST=localhost
DB_PORT=5432
DB_DATABASE=__DB_NAME__
DB_USERNAME=__DB_USER__
DB_PASSWORD=__DB_PWD__
# Daemon configuration
DAEMON_URL=https://__DOMAIN____PATH__/
DAEMON_PORT=__PORT____PORT__
DAEMON_INTERFACE=127.0.0.1
DAEMON_DEBUG=false
DAEMON_VERBOSE=false

View file

@ -6,10 +6,8 @@ After=nginx.service network.target local-fs.target
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment=PUBLIC_URL=https://__DOMAIN____PATH__/
Environment=WS_PORT=__PORT__
WorkingDirectory=__INSTALL_DIR__/ WorkingDirectory=__INSTALL_DIR__/
ExecStart=/usr/bin/php__PHPVERSION__ daemon.php start --url=${PUBLIC_URL} --port=${WS_PORT} ExecStart=/usr/bin/php__PHPVERSION__ daemon.php start
StandardOutput=syslog StandardOutput=syslog
SyslogIdentifier=__APP__ SyslogIdentifier=__APP__
PIDFile=/run/movim.pid PIDFile=/run/movim.pid

View file

@ -43,10 +43,10 @@ chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Adding $app's configuration file..." ynh_script_progression --message="Adding $app's configuration file..."
ynh_add_config --template="db.example.inc.php" --destination="$install_dir/config/db.inc.php" ynh_add_config --template="dot_env" --destination="$install_dir/.env"
chmod 400 "$install_dir/config/db.inc.php" chmod 400 "$install_dir/.env"
chown "$app:$app" "$install_dir/config/db.inc.php" chown "$app:$app" "$install_dir/.env"
#================================================= #=================================================
# BUILD MOVIM # BUILD MOVIM

View file

@ -37,13 +37,17 @@ if [ -z "${fpm_usage:-}" ]; then
ynh_app_setting_set --app="$app" --key=fpm_usage --value="$fpm_usage" ynh_app_setting_set --app="$app" --key=fpm_usage --value="$fpm_usage"
fi fi
if [ -f "$install_dir/config/db.inc.php" ]; then
ynh_secure_remove --file="$install_dir/config/db.inc.php"
fi
#================================================= #=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE # DOWNLOAD, CHECK AND UNPACK SOURCE
#================================================= #=================================================
ynh_script_progression --message="Upgrading source files..." ynh_script_progression --message="Upgrading source files..."
# Download, check integrity, uncompress and patch the source from app.src # Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep="config/db.inc.php" ynh_setup_source --dest_dir="$install_dir" --full_replace=1 --keep=".env"
chmod -R o-rwx "$install_dir" chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir" chown -R "$app:www-data" "$install_dir"
@ -53,10 +57,10 @@ chown -R "$app:www-data" "$install_dir"
#================================================= #=================================================
ynh_script_progression --message="Updating $app's configuration file..." ynh_script_progression --message="Updating $app's configuration file..."
ynh_add_config --template="db.example.inc.php" --destination="$install_dir/config/db.inc.php" ynh_add_config --template="dot_env" --destination="$install_dir/.env"
chmod 400 "$install_dir/config/db.inc.php" chmod 400 "$install_dir/.env"
chown "$app:$app" "$install_dir/config/db.inc.php" chown "$app:$app" "$install_dir/.env"
#================================================= #=================================================
# BUILD MOVIM # BUILD MOVIM