refactor(backend): 変換後.config.jsonに統一するように+修正など (#16929)

* wip

* Update config.ts

* wip

* convertは元ファイルを変更するようなニュアンスを若干感じるのでcompileに改名

* wip

* Update package.json

* Revert "Update package.json"

This reverts commit e5c2802316.

* wip

* wip

* 謎

* clean up

* wip

* wip

* Revert "wip"

This reverts commit 3aa25ac7cf.

* wip

* wip

* Update dummy.yml

* wip

* Update compile_config.js

* Update compile_config.js

* wip

* Revert "wip"

This reverts commit fd78e097c6.

* Update dummy.yml

* Update compile_config.js
This commit is contained in:
syuilo
2025-12-04 16:49:25 +09:00
committed by GitHub
parent a3c3052d0f
commit 24bd150967
17 changed files with 98 additions and 137 deletions

View File

@@ -217,21 +217,15 @@ export type FulltextSearchProvider = 'sqlLike' | 'sqlPgroonga' | 'meilisearch';
const _filename = fileURLToPath(import.meta.url);
const _dirname = dirname(_filename);
/**
* Path of configuration directory
*/
const dir = `${_dirname}/../../../.config`;
const compiledConfigFilePathForTest = resolve(_dirname, '../../../built/._config_.json');
/**
* Path of configuration file
*/
export const path = process.env.MISSKEY_CONFIG_YML
? 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 const compiledConfigFilePath = fs.existsSync(compiledConfigFilePathForTest) ? compiledConfigFilePathForTest : resolve(_dirname, '../../../built/.config.json');
export function loadConfig(): Config {
if (!fs.existsSync(compiledConfigFilePath)) {
throw new Error('Compiled configuration file not found. Try running \'pnpm compile-config\'.');
}
const meta = JSON.parse(fs.readFileSync(`${_dirname}/../../../built/meta.json`, 'utf-8'));
const frontendManifestExists = fs.existsSync(_dirname + '/../../../built/_frontend_vite_/manifest.json');
@@ -243,7 +237,7 @@ export function loadConfig(): Config {
JSON.parse(fs.readFileSync(`${_dirname}/../../../built/_frontend_embed_vite_/manifest.json`, 'utf-8'))
: { 'src/boot.ts': { file: null } };
const config = JSON.parse(fs.readFileSync(path, 'utf-8')) as Source;
const config = JSON.parse(fs.readFileSync(compiledConfigFilePath, 'utf-8')) as Source;
const url = tryCreateUrl(config.url ?? process.env.MISSKEY_URL ?? '');
const version = meta.version;