mirror of
https://github.com/aljazceru/dvmcp.git
synced 2025-12-17 05:14:24 +01:00
Revert "chore: fix missing config file"
This reverts commit e2551547ef.
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user