From b9b9cd0c78c9697e213780907c20b83006a2c083 Mon Sep 17 00:00:00 2001 From: tamaina Date: Tue, 25 Apr 2023 15:18:03 +0900 Subject: [PATCH] =?UTF-8?q?enhance(server):=20=E7=92=B0=E5=A2=83=E5=A4=89?= =?UTF-8?q?=E6=95=B0MISSKEY=5FCONFIG=5FYML=E3=81=A7default.yml=E3=82=92?= =?UTF-8?q?=E4=BB=BB=E6=84=8F=E3=81=AEyml=E3=81=AB=E5=A4=89=E6=9B=B4?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E3=81=AB=20(#10712)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * enhance(server): MISSKEY_CONFIG_YMLでconfigを設定可能に * update changelog --- CHANGELOG.md | 1 + packages/backend/src/config.ts | 11 ++++++----- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 97ce4ec7b8..0a8dabfacb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -38,6 +38,7 @@ - 新しい実績を追加 ### Server +- 環境変数MISSKEY_CONFIG_YMLで設定ファイルをdefault.ymlから変更可能に - Fix: エクスポートデータの拡張子がunknownになる問題を修正 - Fix: Content-Dispositionのパースでエラーが発生した場合にダウンロードが完了しない問題を修正 - Fix: API: i/update avatarIdとbannerIdにnullを渡した時、画像がリセットされない問題を修正 diff --git a/packages/backend/src/config.ts b/packages/backend/src/config.ts index e4f7601fa9..b6ec549965 100644 --- a/packages/backend/src/config.ts +++ b/packages/backend/src/config.ts @@ -4,7 +4,7 @@ import * as fs from 'node:fs'; import { fileURLToPath } from 'node:url'; -import { dirname } from 'node:path'; +import { dirname, resolve } from 'node:path'; import * as yaml from 'js-yaml'; /** @@ -132,10 +132,11 @@ const dir = `${_dirname}/../../../.config`; /** * Path of configuration file */ -const path = process.env.NODE_ENV === 'test' - ? `${dir}/test.yml` - : `${dir}/default.yml`; - +const path = process.env.MISSKEY_CONFIG_YML + ? resolve(dir, process.env.MISSKEY_CONFIG_YML) + : process.env.NODE_ENV === 'test' + ? resolve(dir, 'test.yml') + : resolve(dir, 'config.yml'); export function loadConfig() { const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../built/meta.json`, 'utf-8')); const clientManifestExists = fs.existsSync(_dirname + '/../../../built/_vite_/manifest.json');