This commit is contained in:
syuilo 2025-12-03 18:37:56 +09:00
parent eb1d07cd82
commit 4580ae1e30
2 changed files with 6 additions and 13 deletions

View File

@ -3,8 +3,7 @@
* SPDX-License-Identifier: AGPL-3.0-only * SPDX-License-Identifier: AGPL-3.0-only
*/ */
import { path as configYamlPath } from '../../built/config.js'; import { compiledConfigFilePath } from '../../built/config.js';
import * as yaml from 'js-yaml';
import fs from "node:fs"; import fs from "node:fs";
export function isConcurrentIndexMigrationEnabled() { export function isConcurrentIndexMigrationEnabled() {
@ -14,7 +13,7 @@ export function isConcurrentIndexMigrationEnabled() {
let loadedConfigCache = undefined; let loadedConfigCache = undefined;
function loadConfigInternal() { function loadConfigInternal() {
const config = yaml.load(fs.readFileSync(configYamlPath, 'utf-8')); const config = JSON.parse(fs.readFileSync(compiledConfigFilePath, 'utf-8'));
return { return {
disallowExternalApRedirect: Boolean(config.disallowExternalApRedirect ?? false), disallowExternalApRedirect: Boolean(config.disallowExternalApRedirect ?? false),

View File

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