From aa75195250ce6d8cb12c372f518faf1633563fae Mon Sep 17 00:00:00 2001 From: undefined Date: Sat, 15 Mar 2025 06:46:21 +0800 Subject: [PATCH] core: command: respect HYDRO_PROFILE --- packages/hydrooj/src/commands/db.ts | 2 +- packages/hydrooj/src/commands/install.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/hydrooj/src/commands/db.ts b/packages/hydrooj/src/commands/db.ts index 5e8432473..e34575004 100644 --- a/packages/hydrooj/src/commands/db.ts +++ b/packages/hydrooj/src/commands/db.ts @@ -5,6 +5,7 @@ import readline from 'readline/promises'; import cac, { CAC } from 'cac'; import fs from 'fs-extra'; import { Logger, size } from '@hydrooj/utils'; +import { hydroPath } from '../options'; const argv = cac().parse(); const logger = new Logger('db'); @@ -15,7 +16,6 @@ const exec = (...args: Parameters) => { if (res.status) throw new Error(`Error: Exited with code ${res.status}`); return res; }; -const hydroPath = path.resolve(os.homedir(), '.hydro'); const dir = `${os.tmpdir()}/${Math.random().toString(36).substring(2)}`; function getUrl() { const dbConfig = fs.readFileSync(path.resolve(hydroPath, 'config.json'), 'utf-8'); diff --git a/packages/hydrooj/src/commands/install.ts b/packages/hydrooj/src/commands/install.ts index b2db45b69..4256c83c7 100644 --- a/packages/hydrooj/src/commands/install.ts +++ b/packages/hydrooj/src/commands/install.ts @@ -8,6 +8,7 @@ import superagent from 'superagent'; import tar from 'tar'; import { extractZip, Logger } from '@hydrooj/utils'; import { version } from 'hydrooj/package.json'; +import { hydroPath } from '../options'; const logger = new Logger('install'); let yarnVersion = 0; @@ -18,7 +19,6 @@ try { // yarn 2 does not support global dir } -const hydroPath = path.resolve(os.homedir(), '.hydro'); const addonDir = path.join(hydroPath, 'addons'); function downloadAndExtractTgz(url: string, dest: string) {