diff --git a/.config.php b/.config.php new file mode 100644 index 0000000..74a55c9 --- /dev/null +++ b/.config.php @@ -0,0 +1,45 @@ + [ + '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, + ], +]; diff --git a/.gitignore b/.gitignore index 8264c45..563fc5c 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ uoj_data_1/ uoj_data_2/ .php-cs-fixer.cache docker-compose.local.yml +.config.php diff --git a/docker-compose.development.yml b/docker-compose.development.yml index 90fb54b..37c4444 100644 --- a/docker-compose.development.yml +++ b/docker-compose.development.yml @@ -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 diff --git a/docker-compose.yml b/docker-compose.yml index f96fde1..1da0339 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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 diff --git a/web/app/.default-config.php b/web/app/.default-config.php index dc84dbf..fab8e0e 100644 --- a/web/app/.default-config.php +++ b/web/app/.default-config.php @@ -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, + ], ]; diff --git a/web/install.sh b/web/install.sh index f1996be..cc5b553 100644 --- a/web/install.sh +++ b/web/install.sh @@ -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 <include/uoj_work_path.h < 'http'/'protocol' => '$_uoj_protocol_'/g" /var/www/uoj/app/.config.php #Start services service ntp restart service apache2 restart