feat(server): add DEFAULT_PORT constant and use it for server port configuration

This commit is contained in:
2026-04-16 17:16:53 +05:30
parent fad43eda66
commit 2cfbe90c26
2 changed files with 6 additions and 3 deletions
+3
View File
@@ -12,3 +12,6 @@ export const EMBEDDING_PROVIDER =
process.env.ASK262_EMBEDDING_PROVIDER ?? "ollama"; process.env.ASK262_EMBEDDING_PROVIDER ?? "ollama";
export const FIREWORKS_EMBEDDING_MODEL = "fireworks/qwen3-embedding-8b"; export const FIREWORKS_EMBEDDING_MODEL = "fireworks/qwen3-embedding-8b";
export const FIREWORKS_BASE_URL = "https://api.fireworks.ai/inference/v1"; export const FIREWORKS_BASE_URL = "https://api.fireworks.ai/inference/v1";
// Server configuration
export const DEFAULT_PORT = 8081;
+3 -3
View File
@@ -32,7 +32,7 @@ import {
sectionContentToolMetadata, sectionContentToolMetadata,
sectionContentToolName, sectionContentToolName,
} from "./agent-tools/index.js"; } from "./agent-tools/index.js";
import { STORAGE_DIR as STORAGE_DIR_REL } from "./constants.js"; import { DEFAULT_PORT, STORAGE_DIR as STORAGE_DIR_REL } from "./constants.js";
import { createEmbeddings } from "./lib/embeddings-factory.js"; import { createEmbeddings } from "./lib/embeddings-factory.js";
// Resolve storage path relative to this script's directory // Resolve storage path relative to this script's directory
@@ -43,8 +43,8 @@ const STORAGE_DIR = path.resolve(__dirname, "..", STORAGE_DIR_REL);
// Initialize embeddings based on ASK262_EMBEDDING_PROVIDER env var // Initialize embeddings based on ASK262_EMBEDDING_PROVIDER env var
const embeddings = createEmbeddings(); const embeddings = createEmbeddings();
// Server port (default: 8081) // Server port (uses env var or default from constants)
const PORT = Number(process.env.ASK262_PORT) || 8081; const PORT = Number(process.env.ASK262_PORT) || DEFAULT_PORT;
/** /**
* Factory function to create a fresh MCP server instance. * Factory function to create a fresh MCP server instance.