mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 13:28:41 +00:00
feat: web configs as env
This commit is contained in:
parent
7de9b534c1
commit
a1b48afe53
@ -51,3 +51,12 @@ services:
|
|||||||
- ./uoj_data/web/storage:/opt/uoj/web/app/storage
|
- ./uoj_data/web/storage:/opt/uoj/web/app/storage
|
||||||
ports:
|
ports:
|
||||||
- "80:80"
|
- "80:80"
|
||||||
|
environment:
|
||||||
|
- DATABASE_HOST=uoj-db
|
||||||
|
- DATABASE_PASSWORD=root
|
||||||
|
- JUDGER_SOCKET_PORT=2333
|
||||||
|
- JUDGER_SOCKET_PASSWORD=_judger_socket_password_
|
||||||
|
- SALT_0=salt_0
|
||||||
|
- SALT_1=salt_1
|
||||||
|
- SALT_2=salt_2
|
||||||
|
- SALT_3=salt_3
|
||||||
|
@ -3,10 +3,14 @@ genRandStr(){
|
|||||||
cat /dev/urandom | tr -dc [:alnum:] | head -c $1
|
cat /dev/urandom | tr -dc [:alnum:] | head -c $1
|
||||||
}
|
}
|
||||||
#Set some vars
|
#Set some vars
|
||||||
_database_host_=uoj-db
|
_database_host_="${DATABASE_HOST:-uoj-db}"
|
||||||
_database_password_=root
|
_database_password_="${DATABASE_PASSWORD:-root}"
|
||||||
_judger_socket_port_=2333
|
_judger_socket_port_="${JUDGER_SOCKET_PORT:-2333}"
|
||||||
_judger_socket_password_=_judger_socket_password_
|
_judger_socket_password_="${JUDGER_SOCKET_PASSWORD:-_judger_socket_password_}"
|
||||||
|
_salt0_="${SALT0:-$(genRandStr 32)}"
|
||||||
|
_salt1_="${SALT1:-$(genRandStr 32)}"
|
||||||
|
_salt2_="${SALT2:-$(genRandStr 16)}"
|
||||||
|
_salt3_="${SALT3:-$(genRandStr 16)}"
|
||||||
|
|
||||||
getAptPackage(){
|
getAptPackage(){
|
||||||
printf "\n\n==> Getting environment packages\n"
|
printf "\n\n==> Getting environment packages\n"
|
||||||
@ -81,7 +85,7 @@ initProgress(){
|
|||||||
mkdir -p /var/uoj_data/upload
|
mkdir -p /var/uoj_data/upload
|
||||||
chown -R www-data:www-data /var/uoj_data
|
chown -R www-data:www-data /var/uoj_data
|
||||||
#Replace password placeholders
|
#Replace password placeholders
|
||||||
sed -i -e "s/salt0/$(genRandStr 32)/g" -e "s/salt1/$(genRandStr 16)/g" -e "s/salt2/$(genRandStr 16)/g" -e "s/salt3/$(genRandStr 16)/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /var/www/uoj/app/.config.php
|
sed -i -e "s/salt0/$_salt0_/g" -e "s/salt1/$_salt1_/g" -e "s/salt2/$_salt2_/g" -e "s/salt3/$_salt3_/g" -e "s/_judger_socket_password_/$_judger_socket_password_/g" /var/www/uoj/app/.config.php
|
||||||
#Using cli upgrade to latest
|
#Using cli upgrade to latest
|
||||||
php /var/www/uoj/app/cli.php upgrade:latest
|
php /var/www/uoj/app/cli.php upgrade:latest
|
||||||
#Start services
|
#Start services
|
||||||
|
Loading…
Reference in New Issue
Block a user