mirror of
https://github.com/Sea-Haven-Industries/open-swe.git
synced 2026-09-30 08:03:15 +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=""
|
||||
# Used for setting the git user name & email for commits.
|
||||
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:
|
||||
|
|
|
|||
|
|
@ -16,4 +16,8 @@ DAYTONA_API_KEY=""
|
|||
# Should be the same value as the one used in the web app.
|
||||
GITHUB_TOKEN_ENCRYPTION_KEY=""
|
||||
# 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>;
|
||||
includeApiKey?: boolean;
|
||||
}) {
|
||||
if (!process.env.PORT) {
|
||||
throw new Error("PORT environment variable not found");
|
||||
}
|
||||
const port = process.env.PORT ?? "2024";
|
||||
if (options?.includeApiKey && !process.env.LANGGRAPH_API_KEY) {
|
||||
throw new Error("LANGGRAPH_API_KEY not found");
|
||||
}
|
||||
|
|
@ -14,7 +12,7 @@ export function createLangGraphClient(options?: {
|
|||
...(options?.includeApiKey && {
|
||||
apiKey: process.env.LANGGRAPH_API_KEY,
|
||||
}),
|
||||
apiUrl: `http://localhost:${process.env.PORT}`,
|
||||
apiUrl: `http://localhost:${port}`,
|
||||
defaultHeaders: options?.defaultHeaders,
|
||||
});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue