mirror of
https://github.com/misskey-dev/misskey.git
synced 2026-06-06 08:44:06 +02:00
wip
This commit is contained in:
@@ -17,6 +17,7 @@ const _filename = fileURLToPath(import.meta.url);
|
|||||||
const _dirname = dirname(_filename);
|
const _dirname = dirname(_filename);
|
||||||
|
|
||||||
const configDir = resolve(_dirname, '../../../.config');
|
const configDir = resolve(_dirname, '../../../.config');
|
||||||
|
const OUTPUT_PATH = resolve(configDir, '.config.json');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* YAMLファイルをJSONファイルに変換
|
* YAMLファイルをJSONファイルに変換
|
||||||
@@ -38,22 +39,14 @@ function convertYamlToJson(ymlPath, jsonPath) {
|
|||||||
console.log(`✓ ${ymlPath} → ${jsonPath}`);
|
console.log(`✓ ${ymlPath} → ${jsonPath}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
// default.yml と test.yml を変換
|
|
||||||
convertYamlToJson(
|
|
||||||
resolve(configDir, 'default.yml'),
|
|
||||||
resolve(configDir, 'default.json'),
|
|
||||||
);
|
|
||||||
|
|
||||||
convertYamlToJson(
|
|
||||||
resolve(configDir, 'test.yml'),
|
|
||||||
resolve(configDir, 'test.json'),
|
|
||||||
);
|
|
||||||
|
|
||||||
// MISSKEY_CONFIG_YML 環境変数が指定されている場合も変換
|
|
||||||
if (process.env.MISSKEY_CONFIG_YML) {
|
if (process.env.MISSKEY_CONFIG_YML) {
|
||||||
const customYmlPath = resolve(configDir, process.env.MISSKEY_CONFIG_YML);
|
const customYmlPath = resolve(configDir, process.env.MISSKEY_CONFIG_YML);
|
||||||
const customJsonPath = customYmlPath.replace(/\.ya?ml$/i, '.json');
|
convertYamlToJson(customYmlPath, OUTPUT_PATH);
|
||||||
convertYamlToJson(customYmlPath, customJsonPath);
|
} else {
|
||||||
|
convertYamlToJson(
|
||||||
|
resolve(configDir, process.env.NODE_ENV === 'test' ? 'test.yml' : 'default.yml'),
|
||||||
|
OUTPUT_PATH,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Configuration compiled');
|
console.log('Configuration compiled');
|
||||||
|
|||||||
@@ -225,11 +225,7 @@ const dir = `${_dirname}/../../../.config`;
|
|||||||
/**
|
/**
|
||||||
* Path of configuration file
|
* Path of configuration file
|
||||||
*/
|
*/
|
||||||
export const path = process.env.MISSKEY_CONFIG_YML
|
export const path = resolve(dir, '.config.json');
|
||||||
? resolve(dir, process.env.MISSKEY_CONFIG_YML).replace(/\.ya?ml$/i, '.json')
|
|
||||||
: process.env.NODE_ENV === 'test'
|
|
||||||
? resolve(dir, 'test.json')
|
|
||||||
: resolve(dir, 'default.json');
|
|
||||||
|
|
||||||
export function loadConfig(): Config {
|
export function loadConfig(): Config {
|
||||||
const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../built/meta.json`, 'utf-8'));
|
const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../built/meta.json`, 'utf-8'));
|
||||||
|
|||||||
Reference in New Issue
Block a user