mirror of
https://github.com/YunoHost-Apps/monica_ynh.git
synced 2024-09-03 19:46:23 +02:00
updated .env and genrate random_key in install
This commit is contained in:
parent
d7956d9bd7
commit
d39dd1ea22
3 changed files with 38 additions and 18 deletions
11
conf/.env
11
conf/.env
|
@ -10,7 +10,7 @@ APP_DEBUG=false
|
|||
# this secure otherwise, everyone will be able to access your application.
|
||||
# Must be 32 characters long exactly.
|
||||
# Use `php artisan key:generate` to generate a random key.
|
||||
APP_KEY=ChangeMeBy32KeyLengthOrGenerated
|
||||
APP_KEY=random_key
|
||||
|
||||
# Prevent information leakage by referring to IDs with hashIds instead of
|
||||
# the actual IDs used in the database.
|
||||
|
@ -18,7 +18,7 @@ HASH_SALT=ChangeMeBy20+KeyLength
|
|||
HASH_LENGTH=18
|
||||
|
||||
# The URL of your application.
|
||||
APP_URL=
|
||||
APP_URL=http://localhost
|
||||
|
||||
# Database information
|
||||
# To keep this information secure, we urge you to change the default password
|
||||
|
@ -35,6 +35,10 @@ DB_TEST_DATABASE=monica_test
|
|||
DB_TEST_USERNAME=homestead
|
||||
DB_TEST_PASSWORD=secret
|
||||
|
||||
# Use utf8mb4 database charset format to support emoji characters
|
||||
# ⚠ be sure your DBMS supports utf8mb4 format
|
||||
DB_USE_UTF8MB4=true
|
||||
|
||||
# Mail credentials used to send emails from the application.
|
||||
MAIL_DRIVER=mail
|
||||
MAIL_HOST=127.0.0.1
|
||||
|
@ -58,6 +62,9 @@ APP_DEFAULT_LOCALE=language
|
|||
# Ability to disable signups on your instance. Can be true or false. Default to false.
|
||||
APP_DISABLE_SIGNUP=true
|
||||
|
||||
# Enable user email verification.
|
||||
APP_SIGNUP_DOUBLE_OPTIN=false
|
||||
|
||||
# Set trusted proxy IP addresses.
|
||||
# To trust all proxies that connect directly to your server, use a "*".
|
||||
# To trust one or more specific proxies that connect directly to your server, use a comma separated list of IP addresses.
|
||||
|
|
|
@ -25,6 +25,7 @@ path_url="/"
|
|||
admin=$YNH_APP_ARG_ADMIN
|
||||
is_public=$YNH_APP_ARG_IS_PUBLIC
|
||||
language=$YNH_APP_ARG_LANGUAGE
|
||||
random_key=$(ynh_string_random 32)
|
||||
|
||||
# This is a multi-instance app, meaning it can be installed several times independently
|
||||
# The id of the app as stated in the manifest is available as $YNH_APP_ID
|
||||
|
@ -62,6 +63,7 @@ ynh_app_setting_set $app path $path_url
|
|||
ynh_app_setting_set $app admin $admin
|
||||
ynh_app_setting_set $app is_public $is_public
|
||||
ynh_app_setting_set $app language $language
|
||||
ynh_app_setting_set $app random_key $random_key
|
||||
|
||||
#=================================================
|
||||
# STANDARD MODIFICATIONS
|
||||
|
@ -115,22 +117,21 @@ ynh_add_fpm7.1_config
|
|||
# SPECIFIC SETUP
|
||||
#=================================================
|
||||
|
||||
# create a user
|
||||
# Get admin email
|
||||
email=$(ynh_user_get_info $admin 'mail')
|
||||
|
||||
# setup application config
|
||||
sudo cp ../conf/.env $final_path/.env
|
||||
cd $final_path && sudo /usr/bin/php7.1 artisan -n key:generate --force
|
||||
cd $final_path && sudo /usr/bin/php7.1 artisan config:clear
|
||||
|
||||
db_name=$(ynh_sanitize_dbid $app)
|
||||
|
||||
sudo sed -i "s/yunouser/$db_name/g" $final_path/.env
|
||||
sudo sed -i "s/yunopass/$db_pwd/g" $final_path/.env
|
||||
sudo sed -i "s/yunobase/$db_name/g" $final_path/.env
|
||||
sudo sed -i "s/yunomail/$email/g" $final_path/.env
|
||||
sudo sed -i "s/yunodomain/$domain/g" $final_path/.env
|
||||
sudo sed -i "s/language/$language/g" $final_path/.env
|
||||
ynh_replace_string "random_key" "$random_key" "$final_path/.env"
|
||||
ynh_replace_string "yunouser" "$db_name" "$final_path/.env"
|
||||
ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env"
|
||||
ynh_replace_string "yunobase" "$db_name" "$final_path/.env"
|
||||
ynh_replace_string "yunomail" "$email" "$final_path/.env"
|
||||
ynh_replace_string "yunodomain" "$domain" "$final_path/.env"
|
||||
ynh_replace_string "language" "$language" "$final_path/.env"
|
||||
|
||||
|
||||
# Install nodejs packages
|
||||
|
@ -139,6 +140,7 @@ cd $final_path && sudo_path npm run production
|
|||
|
||||
|
||||
# setup application config
|
||||
cd $final_path && sudo /usr/bin/php7.1 artisan config:clear
|
||||
cd $final_path && sudo /usr/bin/php7.1 artisan -q migrate --force
|
||||
cd $final_path && sudo /usr/bin/php7.1 artisan -q storage:link
|
||||
cd $final_path && sudo /usr/bin/php7.1 artisan -q setup:production --force
|
||||
|
|
|
@ -21,7 +21,10 @@ admin=$(ynh_app_setting_get $app admin)
|
|||
is_public=$(ynh_app_setting_get $app is_public)
|
||||
final_path=$(ynh_app_setting_get $app final_path)
|
||||
db_name=$(ynh_app_setting_get $app db_name)
|
||||
db_pwd=$(ynh_app_setting_get $app mysqlpwd)
|
||||
language=$(ynh_app_setting_get $app language)
|
||||
random_key=$(ynh_app_setting_get $app random_key)
|
||||
|
||||
#=================================================
|
||||
# ENSURE DOWNWARD COMPATIBILITY
|
||||
#=================================================
|
||||
|
@ -63,15 +66,9 @@ path_url=$(ynh_normalize_url_path $path_url)
|
|||
#=================================================
|
||||
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
||||
#=================================================
|
||||
# Create a temporary directory
|
||||
tmpdir="$(mktemp -d)"
|
||||
cp -a "$final_path/.env" "$tmpdir/.env"
|
||||
|
||||
# Download, check integrity, uncompress and patch the source from app.src
|
||||
ynh_setup_source "$final_path"
|
||||
cp -a "$tmpdir/.env" "$final_path/.env"
|
||||
#remove tmp dir
|
||||
sudo rm -Rf "$tmpdir"
|
||||
|
||||
|
||||
#=================================================
|
||||
# NGINX CONFIGURATION
|
||||
|
@ -103,6 +100,20 @@ ynh_install_app_dependencies php7.1 php7.1-zip php7.1-fpm php7.1-mysql php7.1-xm
|
|||
ynh_add_fpm7.1_config
|
||||
|
||||
# setup application config
|
||||
# Get admin email
|
||||
email=$(ynh_user_get_info $admin 'mail')
|
||||
sudo cp ../conf/.env $final_path/.env
|
||||
|
||||
db_name=$(ynh_sanitize_dbid $app)
|
||||
|
||||
ynh_replace_string "random_key" "$random_key" "$final_path/.env"
|
||||
ynh_replace_string "yunouser" "$db_name" "$final_path/.env"
|
||||
ynh_replace_string "yunopass" "$db_pwd" "$final_path/.env"
|
||||
ynh_replace_string "yunobase" "$db_name" "$final_path/.env"
|
||||
ynh_replace_string "yunomail" "$email" "$final_path/.env"
|
||||
ynh_replace_string "yunodomain" "$domain" "$final_path/.env"
|
||||
ynh_replace_string "language" "$language" "$final_path/.env"
|
||||
|
||||
cd $final_path && sudo /usr/bin/php7.1 artisan migrate --force
|
||||
|
||||
#=================================================
|
||||
|
|
Loading…
Add table
Reference in a new issue