- A new command-line option --config-path is added to provide a custom configuration file path.

- The default configuration file path is maintained for backward compatibility.
- The usage instructions in the README are updated to include the new option.

Now, when you run the CLI with the `--configure` flag, you can specify a path to your configuration file, and the application will use that file for its configuration.
This commit is contained in:
gzuuus
2025-03-24 21:56:19 +01:00
parent 247510d13e
commit d09f5ea06a
8 changed files with 32 additions and 6 deletions

View File

@@ -1,3 +1,4 @@
- [x] Add flag `--config-path` to cli
- [ ] Add encryption - [ ] Add encryption
- [ ] Add payments - [ ] Add payments
- [ ] Add mcp inspector - [ ] Add mcp inspector

View File

@@ -19,6 +19,12 @@ cp config.example.yml config.dvmcp.yml
nano config.dvmcp.yml nano config.dvmcp.yml
``` ```
You can also specify a custom configuration file path using the `--config-path` flag:
```bash
npx @dvmcp/bridge --config-path /path/to/custom/config.yml
```
## Usage ## Usage
**Prerequisite:** Ensure you have [Bun](https://bun.sh/) installed. **Prerequisite:** Ensure you have [Bun](https://bun.sh/) installed.

View File

@@ -14,7 +14,14 @@ import {
import { argv } from 'process'; import { argv } from 'process';
import type { Config } from './src/types'; import type { Config } from './src/types';
const configPath = join(process.cwd(), 'config.dvmcp.yml'); const defaultConfigPath = join(process.cwd(), 'config.dvmcp.yml');
let configPath = defaultConfigPath;
const configPathArgIndex = argv.indexOf('--config-path');
if (configPathArgIndex !== -1 && argv[configPathArgIndex + 1]) {
configPath = argv[configPathArgIndex + 1];
console.log(configPath);
}
const configFields: Record<string, FieldConfig> = { const configFields: Record<string, FieldConfig> = {
nostr: { nostr: {
@@ -113,7 +120,7 @@ const cliMain = async () => {
if (argv.includes('--configure')) { if (argv.includes('--configure')) {
await configure(); await configure();
} }
console.log('1', configPath);
if (!existsSync(configPath)) { if (!existsSync(configPath)) {
console.log( console.log(
`${CONFIG_EMOJIS.INFO} No configuration file found. Starting setup...` `${CONFIG_EMOJIS.INFO} No configuration file found. Starting setup...`

View File

@@ -1,6 +1,6 @@
{ {
"name": "@dvmcp/bridge", "name": "@dvmcp/bridge",
"version": "0.1.14", "version": "0.1.15",
"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

@@ -183,7 +183,7 @@ export class ConfigGenerator<T extends Record<string, any>> {
array.forEach((item: string, index: number) => { array.forEach((item: string, index: number) => {
console.log(`${CONFIG_EMOJIS.INFO} ${index + 1}. ${item}`); console.log(`${CONFIG_EMOJIS.INFO} ${index + 1}. ${item}`);
}); });
if (await this.promptYesNo(`${emoji} Remove any items?`, false)) { if (await this.promptYesNo(`${emoji} Remove any items?`, false)) {
while (true) { while (true) {
const index = const index =

View File

@@ -18,6 +18,12 @@ cp config.example.yml config.dvmcp.yml
nano config.dvmcp.yml nano config.dvmcp.yml
``` ```
You can also specify a custom configuration file path using the `--config-path` flag.
```bash
npx @dvmcp/discovery --config-path /path/to/custom/config.dvmcp.yml
```
## Usage ## Usage
**Prerequisite:** Ensure you have [Bun](https://bun.sh/) installed. **Prerequisite:** Ensure you have [Bun](https://bun.sh/) installed.

View File

@@ -12,7 +12,13 @@ import type { Config } from './src/config.js';
import { argv } from 'process'; import { argv } from 'process';
import { existsSync } from 'fs'; import { existsSync } from 'fs';
const configPath = join(process.cwd(), 'config.dvmcp.yml'); const defaultConfigPath = join(process.cwd(), 'config.dvmcp.yml');
let configPath = defaultConfigPath;
const configPathArgIndex = argv.indexOf('--config-path');
if (configPathArgIndex !== -1 && argv[configPathArgIndex + 1]) {
configPath = argv[configPathArgIndex + 1];
}
const configFields: Record<string, FieldConfig> = { const configFields: Record<string, FieldConfig> = {
nostr: { nostr: {

View File

@@ -1,6 +1,6 @@
{ {
"name": "@dvmcp/discovery", "name": "@dvmcp/discovery",
"version": "0.1.11", "version": "0.1.12",
"description": "Discovery service for MCP tools in the Nostr DVM ecosystem", "description": "Discovery service for MCP tools in the Nostr DVM ecosystem",
"module": "index.ts", "module": "index.ts",
"type": "module", "type": "module",