mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-25 00:28:42 +00:00
feat: mount config file instead of passing env
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
3c2ab13e0d
commit
fadf722527
45
.config.php
Normal file
45
.config.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
return [
|
||||
'profile' => [
|
||||
'oj-name' => '石家庄二中信息学在线评测系统',
|
||||
'oj-name-short' => 'S2OJ',
|
||||
'administrator' => 'root',
|
||||
'admin-email' => 'admin@sjzezoj.com',
|
||||
'QQ-group' => '',
|
||||
'ICP-license' => '冀ICP备2020028886号',
|
||||
],
|
||||
'database' => [
|
||||
'database' => 'app_uoj233',
|
||||
'username' => 'root',
|
||||
'password' => 'root',
|
||||
'host' => 'uoj-db',
|
||||
'port' => '3306',
|
||||
],
|
||||
'security' => [
|
||||
'user' => [
|
||||
'client_salt' => 'salt_0',
|
||||
],
|
||||
'cookie' => [
|
||||
'checksum_salt' => ['salt_1', 'salt_2', 'salt_3'],
|
||||
],
|
||||
],
|
||||
'mail' => [
|
||||
'noreply' => [
|
||||
'username' => 'noreply@local_uoj.ac',
|
||||
'password' => '_mail_noreply_password_',
|
||||
'host' => 'smtp.local_uoj.ac',
|
||||
'secure' => 'tls',
|
||||
'port' => 587,
|
||||
]
|
||||
],
|
||||
'judger' => [
|
||||
'socket' => [
|
||||
'port' => '2333',
|
||||
'password' => '_judger_socket_password_'
|
||||
],
|
||||
],
|
||||
'switch' => [
|
||||
'blog-domain-mode' => 3,
|
||||
'open-register' => false,
|
||||
],
|
||||
];
|
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@ uoj_data_1/
|
||||
uoj_data_2/
|
||||
.php-cs-fixer.cache
|
||||
docker-compose.local.yml
|
||||
.config.php
|
||||
|
@ -60,15 +60,6 @@ services:
|
||||
volumes:
|
||||
- ./uoj_data/web/data:/var/uoj_data
|
||||
- ./uoj_data/web/storage:/opt/uoj/web/app/storage
|
||||
- ./.config.php:/opt/uoj/web/app/.config.php
|
||||
ports:
|
||||
- "80:80"
|
||||
environment:
|
||||
- UOJ_PROTOCOL=http
|
||||
- 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
|
||||
|
@ -43,15 +43,6 @@ services:
|
||||
volumes:
|
||||
- ./uoj_data/web/data:/var/uoj_data
|
||||
- ./uoj_data/web/storage:/opt/uoj/web/app/storage
|
||||
- ./.config.php:/opt/uoj/web/app/.config.php
|
||||
ports:
|
||||
- "80:80"
|
||||
environment:
|
||||
- UOJ_PROTOCOL=https
|
||||
- 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
|
||||
|
@ -20,21 +20,21 @@ return [
|
||||
'domain' => null,
|
||||
'main' => [
|
||||
'protocol' => 'http',
|
||||
'host' => '_httpHost_',
|
||||
'port' => '80/443'
|
||||
'host' => UOJContext::requestDomain(),
|
||||
'port' => '80/443',
|
||||
],
|
||||
'blog' => [
|
||||
'protocol' => 'http',
|
||||
'host' => '_httpHost_',
|
||||
'port' => '80/443'
|
||||
'host' => UOJContext::requestDomain(),
|
||||
'port' => '80/443',
|
||||
]
|
||||
],
|
||||
'security' => [
|
||||
'user' => [
|
||||
'client_salt' => 'salt0'
|
||||
'client_salt' => 'salt0',
|
||||
],
|
||||
'cookie' => [
|
||||
'checksum_salt' => ['salt1', 'salt2', 'salt3']
|
||||
'checksum_salt' => ['salt1', 'salt2', 'salt3'],
|
||||
],
|
||||
],
|
||||
'mail' => [
|
||||
@ -43,17 +43,17 @@ return [
|
||||
'password' => '_mail_noreply_password_',
|
||||
'host' => 'smtp.local_uoj.ac',
|
||||
'secure' => 'tls',
|
||||
'port' => 587
|
||||
'port' => 587,
|
||||
]
|
||||
],
|
||||
'judger' => [
|
||||
'socket' => [
|
||||
'port' => '233',
|
||||
'password' => '_judger_socket_password_'
|
||||
'password' => '_judger_socket_password_',
|
||||
]
|
||||
],
|
||||
'switch' => [
|
||||
'blog-domain-mode' => 3,
|
||||
'open-register' => false
|
||||
]
|
||||
'open-register' => false,
|
||||
],
|
||||
];
|
||||
|
@ -60,14 +60,6 @@ setWebConf(){
|
||||
# Set webroot path
|
||||
ln -sf /opt/uoj/web /var/www/uoj
|
||||
chown -R www-data /var/www/uoj/app/storage
|
||||
# Set web config file
|
||||
php7.4 -a <<UOJEOF
|
||||
\$config = include '/var/www/uoj/app/.default-config.php';
|
||||
\$config['database']['host']='$_database_host_';
|
||||
\$config['database']['password']='$_database_password_';
|
||||
\$config['judger']['socket']['port']='$_judger_socket_port_';
|
||||
file_put_contents('/var/www/uoj/app/.config.php', "<?php\nreturn ".str_replace('\'_httpHost_\'','UOJContext::requestDomain()',var_export(\$config, true)).";\n");
|
||||
UOJEOF
|
||||
# Prepare local sandbox
|
||||
cd /opt/uoj/judger/uoj_judger
|
||||
cat >include/uoj_work_path.h <<UOJEOF
|
||||
@ -84,9 +76,6 @@ initProgress(){
|
||||
#Set uoj_data path
|
||||
mkdir -p /var/uoj_data/upload
|
||||
chown -R www-data:www-data /var/uoj_data
|
||||
#Replace password placeholders
|
||||
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
|
||||
sed -i -e "s/'protocol' => 'http'/'protocol' => '$_uoj_protocol_'/g" /var/www/uoj/app/.config.php
|
||||
#Start services
|
||||
service ntp restart
|
||||
service apache2 restart
|
||||
|
Loading…
Reference in New Issue
Block a user