enhance(server): 環境変数MISSKEY_CONFIG_YMLでdefault.ymlを任意のymlに変更可能に (#10712)

* enhance(server): MISSKEY_CONFIG_YMLでconfigを設定可能に

* update changelog
This commit is contained in:
tamaina
2023-04-25 15:18:03 +09:00
committed by GitHub
parent f3206d094d
commit b9b9cd0c78
2 changed files with 7 additions and 5 deletions

View File

@@ -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');