mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-10-04 11:22:10 +00:00
fix: Improve DX for getting port for agent (#221)
* fix: Improve DX for getting port for agent * docs
This commit is contained in:
parent
ac9f6a3986
commit
38dc6ebdf4
3 changed files with 11 additions and 5 deletions
|
|
@ -52,6 +52,10 @@ DAYTONA_API_KEY=""
|
||||||
GITHUB_TOKEN_ENCRYPTION_KEY=""
|
GITHUB_TOKEN_ENCRYPTION_KEY=""
|
||||||
# Used for setting the git user name & email for commits.
|
# Used for setting the git user name & email for commits.
|
||||||
GITHUB_APP_NAME="open-swe-dev"
|
GITHUB_APP_NAME="open-swe-dev"
|
||||||
|
|
||||||
|
# Defaults to 2024 if not set.
|
||||||
|
# LGP will automatically set this for you in production.
|
||||||
|
# PORT="2024"
|
||||||
```
|
```
|
||||||
|
|
||||||
And the web `.env` file should contain the following variables:
|
And the web `.env` file should contain the following variables:
|
||||||
|
|
|
||||||
|
|
@ -16,4 +16,8 @@ DAYTONA_API_KEY=""
|
||||||
# Should be the same value as the one used in the web app.
|
# Should be the same value as the one used in the web app.
|
||||||
GITHUB_TOKEN_ENCRYPTION_KEY=""
|
GITHUB_TOKEN_ENCRYPTION_KEY=""
|
||||||
# Used for setting the git user name & email for commits.
|
# Used for setting the git user name & email for commits.
|
||||||
GITHUB_APP_NAME="open-swe-dev"
|
GITHUB_APP_NAME="open-swe-dev"
|
||||||
|
|
||||||
|
# Defaults to 2024 if not set.
|
||||||
|
# LGP will automatically set this for you in production.
|
||||||
|
# PORT="2024"
|
||||||
|
|
|
||||||
|
|
@ -4,9 +4,7 @@ export function createLangGraphClient(options?: {
|
||||||
defaultHeaders?: Record<string, string>;
|
defaultHeaders?: Record<string, string>;
|
||||||
includeApiKey?: boolean;
|
includeApiKey?: boolean;
|
||||||
}) {
|
}) {
|
||||||
if (!process.env.PORT) {
|
const port = process.env.PORT ?? "2024";
|
||||||
throw new Error("PORT environment variable not found");
|
|
||||||
}
|
|
||||||
if (options?.includeApiKey && !process.env.LANGGRAPH_API_KEY) {
|
if (options?.includeApiKey && !process.env.LANGGRAPH_API_KEY) {
|
||||||
throw new Error("LANGGRAPH_API_KEY not found");
|
throw new Error("LANGGRAPH_API_KEY not found");
|
||||||
}
|
}
|
||||||
|
|
@ -14,7 +12,7 @@ export function createLangGraphClient(options?: {
|
||||||
...(options?.includeApiKey && {
|
...(options?.includeApiKey && {
|
||||||
apiKey: process.env.LANGGRAPH_API_KEY,
|
apiKey: process.env.LANGGRAPH_API_KEY,
|
||||||
}),
|
}),
|
||||||
apiUrl: `http://localhost:${process.env.PORT}`,
|
apiUrl: `http://localhost:${port}`,
|
||||||
defaultHeaders: options?.defaultHeaders,
|
defaultHeaders: options?.defaultHeaders,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue