Add a port override env var
This commit is contained in:
22
README.md
22
README.md
@@ -44,20 +44,25 @@ There are two ways to configure the environment with the Obsidian REST API Key.
|
||||
],
|
||||
"env": {
|
||||
"OBSIDIAN_API_KEY": "<your_api_key_here>",
|
||||
"OBSIDIAN_HOST": "<your_obsidian_host>"
|
||||
"OBSIDIAN_HOST": "<your_obsidian_host>",
|
||||
"OBSIDIAN_PORT": "<your_obsidian_port>"
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
2. Create a `.env` file in the working directory with the following required variable:
|
||||
2. Create a `.env` file in the working directory with the following required variables:
|
||||
|
||||
```
|
||||
OBSIDIAN_API_KEY=your_api_key_here
|
||||
OBSIDIAN_HOST=your_obsidian_host
|
||||
OBSIDIAN_PORT=your_obsidian_port
|
||||
```
|
||||
|
||||
Note: You can find the key in the Obsidian plugin config.
|
||||
Note:
|
||||
- You can find the API key in the Obsidian plugin config
|
||||
- Default port is 27124 if not specified
|
||||
- Default host is 127.0.0.1 if not specified
|
||||
|
||||
## Quickstart
|
||||
|
||||
@@ -88,7 +93,12 @@ On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
|
||||
"<dir_to>/mcp-obsidian",
|
||||
"run",
|
||||
"mcp-obsidian"
|
||||
]
|
||||
],
|
||||
"env": {
|
||||
"OBSIDIAN_API_KEY": "<your_api_key_here>",
|
||||
"OBSIDIAN_HOST": "<your_obsidian_host>",
|
||||
"OBSIDIAN_PORT": "<your_obsidian_port>"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,7 +117,9 @@ On Windows: `%APPDATA%/Claude/claude_desktop_config.json`
|
||||
"mcp-obsidian"
|
||||
],
|
||||
"env": {
|
||||
"OBSIDIAN_API_KEY" : "<YOUR_OBSIDIAN_API_KEY>"
|
||||
"OBSIDIAN_API_KEY": "<YOUR_OBSIDIAN_API_KEY>",
|
||||
"OBSIDIAN_HOST": "<your_obsidian_host>",
|
||||
"OBSIDIAN_PORT": "<your_obsidian_port>"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,6 @@
|
||||
import requests
|
||||
import urllib.parse
|
||||
import os
|
||||
from typing import Any
|
||||
|
||||
class Obsidian():
|
||||
@@ -8,7 +9,7 @@ class Obsidian():
|
||||
api_key: str,
|
||||
protocol: str = 'https',
|
||||
host: str = "127.0.0.1",
|
||||
port: int = 27124,
|
||||
port: int = int(os.getenv('OBSIDIAN_PORT', '27124')),
|
||||
verify_ssl: bool = False,
|
||||
):
|
||||
self.api_key = api_key
|
||||
|
Reference in New Issue
Block a user