@@ -14,43 +14,26 @@ network_check
1414update_os
1515
1616msg_info " Installing Dependencies"
17- $STD apt install -y \
18- lsb-release \
19- nginx
17+ $STD apt install -y nginx
2018msg_ok " Installed Dependencies"
2119
22- PHP_VERSION=" 8.3" PHP_MODULE=" common,ctype,fileinfo,mysql,cli" PHP_FPM=" YES" setup_php
20+ PHP_VERSION=" 8.3" PHP_MODULE=" common,ctype,fileinfo,mysql,cli,tokenizer,dom,redis,session,openssl " PHP_FPM=" YES" setup_php
2321setup_composer
2422setup_mariadb
25-
26- msg_info " Setting up Database"
27- DB_NAME=2fauth_db
28- DB_USER=2fauth
29- DB_PASS=$( openssl rand -base64 18 | tr -dc ' a-zA-Z0-9' | head -c13)
30- $STD mariadb -u root -e " CREATE DATABASE $DB_NAME ;"
31- $STD mariadb -u root -e " CREATE USER '$DB_USER '@'localhost' IDENTIFIED BY '$DB_PASS ';"
32- $STD mariadb -u root -e " GRANT ALL ON $DB_NAME .* TO '$DB_USER '@'localhost'; FLUSH PRIVILEGES;"
33- {
34- echo " 2FAuth Credentials"
35- echo " Database User: $DB_USER "
36- echo " Database Password: $DB_PASS "
37- echo " Database Name: $DB_NAME "
38- } >> ~/2FAuth.creds
39- msg_ok " Set up Database"
40-
23+ MARIADB_DB_NAME=" 2fauth_db" MARIADB_DB_USER=" 2fauth" setup_mariadb_db
24+ import_local_ip
4125fetch_and_deploy_gh_release " 2fauth" " Bubka/2FAuth"
4226
4327msg_info " Setup 2FAuth"
44- cd /opt/2fauth || exit
28+ cd /opt/2fauth
4529cp .env.example .env
46- IPADDRESS=$( hostname -I | awk ' {print $1}' )
47- sed -i -e " s|^APP_URL=.*|APP_URL=http://$IPADDRESS |" \
48- -e " s|^DB_CONNECTION=$|DB_CONNECTION=mysql|" \
49- -e " s|^DB_DATABASE=$|DB_DATABASE=$DB_NAME |" \
50- -e " s|^DB_HOST=$|DB_HOST=127.0.0.1|" \
51- -e " s|^DB_PORT=$|DB_PORT=3306|" \
52- -e " s|^DB_USERNAME=$|DB_USERNAME=$DB_USER |" \
53- -e " s|^DB_PASSWORD=$|DB_PASSWORD=$DB_PASS |" .env
30+ sed -i -e " s|^APP_URL=.*|APP_URL=http://$LOCAL_IP |" \
31+ -e " s|^DB_CONNECTION=$|DB_CONNECTION=mysql|" \
32+ -e " s|^DB_DATABASE=$|DB_DATABASE=$MARIADB_DB_NAME |" \
33+ -e " s|^DB_HOST=$|DB_HOST=127.0.0.1|" \
34+ -e " s|^DB_PORT=$|DB_PORT=3306|" \
35+ -e " s|^DB_USERNAME=$|DB_USERNAME=$MARIADB_DB_USER |" \
36+ -e " s|^DB_PASSWORD=$|DB_PASSWORD=$MARIADB_DB_PASS |" .env
5437export COMPOSER_ALLOW_SUPERUSER=1
5538$STD composer update --no-plugins --no-scripts
5639$STD composer install --no-dev --prefer-dist --no-plugins --no-scripts
@@ -68,7 +51,7 @@ cat <<EOF >/etc/nginx/conf.d/2fauth.conf
6851server {
6952 listen 80;
7053 root /opt/2fauth/public;
71- server_name $IPADDRESS ;
54+ server_name $LOCAL_IP ;
7255 index index.php;
7356 charset utf-8;
7457
0 commit comments