core: loader: support profile

This commit is contained in:
undefined committed 2024-06-07 06:08:43 +08:00
1 parent 1c8a6ee9ab
commit 8f0476e7cb
9 files changed
+73 -68

No files matched your search

+2 -2
View File
@@ -5,7 +5,7 @@ import {
import mongoUri from 'mongodb-uri';
import { Time } from '@hydrooj/utils';
import { Logger } from '../logger';
import options from '../options';
import { load } from '../options';
import * as bus from './bus';
const logger = new Logger('mongo');
@@ -37,7 +37,7 @@ class MongoService {
}
async start() {
const opts = options() || {};
const opts = load() || {};
let mongourl = MongoService.buildUrl(opts);
const url = mongoUri.parse(mongourl);
if (process.env.CI) {
+1 -1
View File
@@ -127,7 +127,6 @@ export class ConnectionHandler extends ConnectionHandlerOriginal {
}
export async function apply(ctx: Context) {
if (process.env.HYDRO_CLI) return;
ctx.plugin(require('@hydrooj/framework'), {
keys: system.get('session.keys'),
proxy: !!system.get('server.xproxy') || !!system.get('server.xff'),
@@ -137,6 +136,7 @@ export async function apply(ctx: Context) {
xff: system.get('server.xff'),
xhost: system.get('server.xhost'),
});
if (process.env.HYDRO_CLI) return;
ctx.inject(['server'], ({ server, on }) => {
const proxyMiddleware = proxy('/fs', {
target: builtinConfig.file.endPoint,