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';
import { argv } from 'process';
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';
const defaultConfigPath = join(process.cwd(), 'config.dvmcp.yml');
@@ -145,9 +145,6 @@ const deleteAnnouncement = async () => {
};
const cliMain = async () => {
// Allow missing config in CLI mode
setAllowMissingConfig(true);
if (argv.includes('--configure')) {
await configure();
return;

View File

@@ -1,6 +1,6 @@
{
"name": "@dvmcp/bridge",
"version": "0.1.23",
"version": "0.1.22",
"description": "Bridge connecting MCP servers to Nostr's DVM ecosystem",
"module": "index.ts",
"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 {
if (process.env.NODE_ENV === 'test') {
return TEST_CONFIG;
}
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(
`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 {
if (!cachedConfig) {
cachedConfig = loadConfig();
if (cachedConfig === null) {
return TEST_CONFIG;
}
}
return cachedConfig;
}
// For backward compatibility
export const CONFIG = getConfig();