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

Use dotenv instead of db.example.inc.php, cleanup install with that

This commit is contained in:
Salamandar 2024-03-23 22:31:06 +01:00
parent b05c67f191
commit e87726e36a
5 changed files with 23 additions and 26 deletions

14
conf/.env Normal file
View file

@ -0,0 +1,14 @@
# Database configuration
DB_DRIVER=pgsql
DB_HOST=127.0.0.1
DB_PORT=5432
DB_DATABASE=__DB_NAME__
DB_USERNAME=__DB_USER__
DB_PASSWORD=__DB_PWD__
# Daemon configuration
DAEMON_URL=https://__DOMAIN____PATH__/ # Public URL of your Movim instance
DAEMON_PORT=__PORT__ # Port on which the daemon will listen
DAEMON_INTERFACE=127.0.0.1 # Interface on which the daemon will listen, must be an IP
DAEMON_DEBUG=true
DAEMON_VERBOSE=true

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__'
];

View file

@ -9,7 +9,7 @@ Group=__APP__
Environment=PUBLIC_URL=https://__DOMAIN____PATH__/
Environment=WS_PORT=__PORT__
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
SyslogIdentifier=__APP__
PIDFile=/run/movim.pid

View file

@ -34,10 +34,10 @@ chown -R "$app:www-data" "$install_dir"
#=================================================
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=".env" --destination="$install_dir/.env"
chmod 400 "$install_dir/config/db.inc.php"
chown "$app:$app" "$install_dir/config/db.inc.php"
chmod 650 "$install_dir/.env"
chown "$app:$app" "$install_dir/.env"
#=================================================
# BUILD MOVIM
@ -47,8 +47,8 @@ ynh_script_progression --message="Building Movim..."
# Install composer
ynh_install_composer
ynh_exec_warn_less ynh_composer_exec --commands="install"
ynh_exec_warn_less ynh_composer_exec --commands="movim:migrate"
ynh_exec_as "$app" "php$phpversion" "$install_dir/daemon.php" config --username="$admin" --password="$password" --quiet
#=================================================
# SYSTEM CONFIGURATION

View file

@ -20,7 +20,7 @@ ynh_systemd_action --service_name="$app" --action="stop" --log_path="systemd"
ynh_script_progression --message="Upgrading source files..."
# 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
# Temporary workaround to fix movim.ERROR: Error: Call to undefined function GuzzleHttp\Psr7\uri_for()
ynh_replace_string --match_string="0.3.5" --replace_string="0.4.1" --target_file="$install_dir/composer.json"
@ -33,10 +33,10 @@ chown -R "$app:www-data" "$install_dir"
#=================================================
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=".env" --destination="$install_dir/.env"
chmod 400 "$install_dir/config/db.inc.php"
chown "$app:$app" "$install_dir/config/db.inc.php"
chmod 400 "$install_dir/.env"
chown "$app:$app" "$install_dir/.env"
#=================================================
# BUILD MOVIM