diff --git a/conf/db.example.inc.php b/conf/db.example.inc.php deleted file mode 100644 index 26e9bfb..0000000 --- a/conf/db.example.inc.php +++ /dev/null @@ -1,17 +0,0 @@ - '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__' -]; diff --git a/conf/dot_env b/conf/dot_env new file mode 100644 index 0000000..e9f56a1 --- /dev/null +++ b/conf/dot_env @@ -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 diff --git a/conf/systemd.service b/conf/systemd.service index 8e6662d..253e0b6 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -6,10 +6,8 @@ After=nginx.service network.target local-fs.target Type=simple User=__APP__ 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 diff --git a/scripts/install b/scripts/install index 80877e5..f0e4e14 100644 --- a/scripts/install +++ b/scripts/install @@ -43,10 +43,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="dot_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 diff --git a/scripts/upgrade b/scripts/upgrade index 24fc478..cbe7e20 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -37,13 +37,17 @@ if [ -z "${fpm_usage:-}" ]; then ynh_app_setting_set --app="$app" --key=fpm_usage --value="$fpm_usage" 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 #================================================= 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 --keep=".env" chmod -R o-rwx "$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_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" -chown "$app:$app" "$install_dir/config/db.inc.php" +chmod 400 "$install_dir/.env" +chown "$app:$app" "$install_dir/.env" #================================================= # BUILD MOVIM