Revert "chore: fix missing config file"

This reverts commit e2551547ef.
This commit is contained in:
gzuuus
2025-03-27 20:01:12 +01:00
parent e2551547ef
commit 4546ffc35a
3 changed files with 3 additions and 18 deletions

View File

@@ -13,7 +13,7 @@ import {
} from '@dvmcp/commons/config-generator'; } from '@dvmcp/commons/config-generator';
import { argv } from 'process'; import { argv } from 'process';
import type { Config } from './src/types'; import type { Config } from './src/types';
import { setConfigPath, setAllowMissingConfig } from './src/config.js'; import { setConfigPath } from './src/config.js';
import { DVMBridge } from './src/dvm-bridge.js'; import { DVMBridge } from './src/dvm-bridge.js';
const defaultConfigPath = join(process.cwd(), 'config.dvmcp.yml'); const defaultConfigPath = join(process.cwd(), 'config.dvmcp.yml');
@@ -145,9 +145,6 @@ const deleteAnnouncement = async () => {
}; };
const cliMain = async () => { const cliMain = async () => {
// Allow missing config in CLI mode
setAllowMissingConfig(true);
if (argv.includes('--configure')) { if (argv.includes('--configure')) {
await configure(); await configure();
return; return;

View File

@@ -1,6 +1,6 @@
{ {
"name": "@dvmcp/bridge", "name": "@dvmcp/bridge",
"version": "0.1.23", "version": "0.1.22",
"description": "Bridge connecting MCP servers to Nostr's DVM ecosystem", "description": "Bridge connecting MCP servers to Nostr's DVM ecosystem",
"module": "index.ts", "module": "index.ts",
"type": "module", "type": "module",

View File

@@ -84,22 +84,12 @@ function validateMCPServers(servers: any): MCPServerConfig[] {
}); });
} }
let allowMissingConfig = false;
export function setAllowMissingConfig(allow: boolean) {
allowMissingConfig = allow;
}
function loadConfig(): Config { function loadConfig(): Config {
if (process.env.NODE_ENV === 'test') { if (process.env.NODE_ENV === 'test') {
return TEST_CONFIG; return TEST_CONFIG;
} }
if (!existsSync(CONFIG_PATH)) { if (!existsSync(CONFIG_PATH)) {
// If we're in CLI mode, return null to let the CLI handle it
if (allowMissingConfig) {
return null as unknown as Config;
}
throw new Error( throw new Error(
`No config file found at ${CONFIG_PATH}. Please create one based on config.example.yml` `No config file found at ${CONFIG_PATH}. Please create one based on config.example.yml`
); );
@@ -159,11 +149,9 @@ let cachedConfig: Config | null = null;
export function getConfig(): Config { export function getConfig(): Config {
if (!cachedConfig) { if (!cachedConfig) {
cachedConfig = loadConfig(); cachedConfig = loadConfig();
if (cachedConfig === null) {
return TEST_CONFIG;
}
} }
return cachedConfig; return cachedConfig;
} }
// For backward compatibility
export const CONFIG = getConfig(); export const CONFIG = getConfig();