1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/commento_ynh.git synced 2024-09-03 18:16:16 +02:00

Merge pull request #1 from YunoHost-Apps/env

Env
This commit is contained in:
Éric Gaspar 2021-11-25 18:53:17 +01:00 committed by GitHub
commit 231440fc7e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 24 deletions

View file

@ -16,7 +16,7 @@
#upgrade=1 from_commit=CommitHash #upgrade=1 from_commit=CommitHash
backup_restore=1 backup_restore=1
multi_instance=1 multi_instance=1
change_url=0 change_url=1
;;; Options ;;; Options
Email= Email=
Notification=none Notification=none

View file

@ -3,17 +3,17 @@
# Set binding values # Set binding values
COMMENTO_ORIGIN=https://__DOMAIN__ COMMENTO_ORIGIN=https://__DOMAIN__
COMMENTO_PORT=__PORT__ COMMENTO_PORT=__PORT__
COMMENTO_STATIC=__FINALPATH__/ COMMENTO_STATIC=__FINALPATH__
# Set PostgreSQL settings # Set PostgreSQL settings
COMMENTO_POSTGRES=postgres://__DB_USER__:__DB_PWD__@127.0.0.1:5432/__DB_NAME__?sslmode=disable COMMENTO_POSTGRES=postgres://__DB_USER__:__DB_PWD__@127.0.0.1:5432/__DB_NAME__?sslmode=disable
# Set the SMTP credentials # Set the SMTP credentials
COMMENTO_SMTP_HOST=localhost #COMMENTO_SMTP_HOST=localhost
COMMENTO_SMTP_PORT=25 #COMMENTO_SMTP_PORT=25
COMMENTO_SMTP_USERNAME=example@__DOMAIN__ #COMMENTO_SMTP_USERNAME=admin@__DOMAIN__
COMMENTO_SMTP_PASSWORD= #COMMENTO_SMTP_PASSWORD=
COMMENTO_SMTP_FROM_ADDRESS=no-reply@commento.io #COMMENTO_SMTP_FROM_ADDRESS=no-reply@__DOMAIN__
# Set Google OAuth credentials # Set Google OAuth credentials
COMMENTO_GOOGLE_KEY= COMMENTO_GOOGLE_KEY=

View file

@ -1,16 +1,13 @@
[Unit] [Unit]
Description=Commento daemon service Description=Commento: commenting platform
After=network.target postgresql.service After=network.target postgresql.service
[Service] [Service]
Type=simple Type=simple
User=__APP__ User=__APP__
Group=__APP__ Group=__APP__
Environment=COMMENTO_CONFIG_FILE=__FINALPATH__/commento.env
ExecStart=__FINALPATH__/commento ExecStart=__FINALPATH__/commento
Environment=COMMENTO_ORIGIN=https://__DOMAIN__
Environment=COMMENTO_PORT=__PORT__
Environment=COMMENTO_POSTGRES=postgres://__DB_USER__:__DB_PWD__@127.0.0.1:5432/__DB_NAME__?sslmode=disable
Environment=COMMENTO_STATIC=__FINALPATH__
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -17,7 +17,7 @@ old_domain=$YNH_APP_OLD_DOMAIN
old_path=$YNH_APP_OLD_PATH old_path=$YNH_APP_OLD_PATH
new_domain=$YNH_APP_NEW_DOMAIN new_domain=$YNH_APP_NEW_DOMAIN
new_path=$YNH_APP_NEW_PATH new_path="/"
app=$YNH_APP_INSTANCE_NAME app=$YNH_APP_INSTANCE_NAME
@ -28,6 +28,10 @@ ynh_script_progression --message="Loading installation settings..." --weight=1
# Needed for helper "ynh_add_nginx_config" # Needed for helper "ynh_add_nginx_config"
final_path=$(ynh_app_setting_get --app=$app --key=final_path) final_path=$(ynh_app_setting_get --app=$app --key=final_path)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
port=$(ynh_app_setting_get --app=$app --key=port)
#================================================= #=================================================
# BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP # BACKUP BEFORE CHANGE URL THEN ACTIVE TRAP
@ -100,6 +104,17 @@ then
ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf" ynh_store_file_checksum --file="/etc/nginx/conf.d/$new_domain.d/$app.conf"
fi fi
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
domain="$new_domain"
ynh_add_config --template="../conf/.env" --destination="$final_path/commento.env"
chmod 400 "$final_path/commento.env"
chown $app:$app "$final_path/commento.env"
#================================================= #=================================================
# GENERIC FINALISATION # GENERIC FINALISATION
#================================================= #=================================================

View file

@ -106,15 +106,15 @@ ynh_script_progression --message="Configuring NGINX web server..." --weight=1
# Create a dedicated NGINX config # Create a dedicated NGINX config
ynh_add_nginx_config ynh_add_nginx_config
# #================================================= #=================================================
# # ADD A CONFIGURATION # ADD A CONFIGURATION
# #================================================= #=================================================
# ynh_script_progression --message="Adding a configuration file..." --weight=1 ynh_script_progression --message="Adding a configuration file..." --weight=1
# ynh_add_config --template="../conf/.env" --destination="$final_path/.env" ynh_add_config --template="../conf/.env" --destination="$final_path/commento.env"
# chmod 400 "$final_path/.env" chmod 400 "$final_path/commento.env"
# chown $app:$app "$final_path/.env" chown $app:$app "$final_path/commento.env"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD

View file

@ -83,7 +83,7 @@ then
ynh_script_progression --message="Upgrading source files..." --weight=1 ynh_script_progression --message="Upgrading source files..." --weight=1
# 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="$final_path" ynh_setup_source --dest_dir="$final_path" --keep="$final_path/commento.env"
fi fi
chmod 750 "$final_path" chmod 750 "$final_path"
@ -110,10 +110,10 @@ ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# #================================================= # #=================================================
# ynh_script_progression --message="Updating a configuration file..." --weight=1 # ynh_script_progression --message="Updating a configuration file..." --weight=1
# ynh_add_config --template="../conf/.env" --destination="$final_path/.env" # ynh_add_config --template="../conf/.env" --destination="$final_path/commento.env"
# chmod 400 "$final_path/.env" # chmod 400 "$final_path/commento.env"
# chown $app:$app "$final_path/.env" # chown $app:$app "$final_path/commento.env"
#================================================= #=================================================
# SETUP SYSTEMD # SETUP SYSTEMD