fix(config): support HOST_PORT as fallback for PORT environment variable

This commit is contained in:
Lucas Winther committed 2026-09-07 01:16:48 +02:00
1 parent c9ba15bca0
commit 86c7dadb9b
2 files changed
+13 -1

No files matched your search

+12
View File
@@ -82,6 +82,18 @@ describe("Configuration Loader (HTTP & Stdio Support)", () => {
expect(config.apiKey).toBeUndefined();
});
test("loads HTTP configuration when HOST_PORT is set as fallback without PORT", () => {
process.env.OPENPROJECT_BASE_URL = "https://openproject.example.com";
delete process.env.OPENPROJECT_API_KEY;
delete process.env.PORT;
process.env.HOST_PORT = "3000";
const config = loadConfig();
expect(config.baseUrl).toBe("https://openproject.example.com");
expect(config.port).toBe(3000);
expect(config.apiKey).toBeUndefined();
});
test("loads HTTP configuration with API key when provided", () => {
process.env.OPENPROJECT_BASE_URL = "https://openproject.example.com";
process.env.OPENPROJECT_API_KEY = "test-key";