Skip to content

armgit / E2B

Public Imported from GitHub
0

Open-source, secure environment with real-world tools for enterprise-grade agents.

Change quart run command; Change local ports to use dynamic ports

Tomas Valentad18862b7376a
diff --git a/api-service/app.py b/api-service/app.py
index a453b9fe4..f0b02805d 100644
--- a/api-service/app.py
+++ b/api-service/app.py
@@ -93,7 +93,9 @@ async def generate():
url: str | None = None
# Disable deployment if there AWS creds are not present
- if os.environ.get("AWS_ACCESS_KEY_ID") and os.environ.get("AWS_SECRET_ACCESS_KEY"):
+ if os.environ.get("AWS_ACCESS_KEY_ID") and os.environ.get(
+ "AWS_SECRET_ACCESS_KEY"
+ ):
await db.update_state(run_id=run_id, state=DeploymentState.Deploying)
url = await playground.deploy(project_id)
@@ -105,7 +107,3 @@ async def generate():
finally:
if playground is not None:
playground.close()
-
-
-if __name__ == "__main__":
- app.run(debug=True, use_reloader=True)
diff --git a/api-service/playground/src/server.ts b/api-service/playground/src/server.ts
index d76fd2226..cd475677c 100644
--- a/api-service/playground/src/server.ts
+++ b/api-service/playground/src/server.ts
@@ -1,6 +1,6 @@
import { app } from './app'
-const port = 9001
+const port = 49160
app.listen(port, () =>
console.log(`Listening at http://localhost:${port}`)
diff --git a/api-service/playground/swagger.json b/api-service/playground/swagger.json
index 679f64175..ac1ef2e9a 100644
--- a/api-service/playground/swagger.json
+++ b/api-service/playground/swagger.json
@@ -833,7 +833,7 @@
},
"servers": [
{
- "url": "https://localhost:9001/"
+ "url": "https://localhost:49160/"
}
]
}
\ No newline at end of file
diff --git a/api-service/playground/tsoa.json b/api-service/playground/tsoa.json
index c9a40189c..d62ef21df 100644
--- a/api-service/playground/tsoa.json
+++ b/api-service/playground/tsoa.json
@@ -7,7 +7,7 @@
"spec": {
"outputDirectory": "./",
"specVersion": 3,
- "host": "localhost:9001"
+ "host": "localhost:49160"
},
"routes": {
"routesDir": "src/generated"
diff --git a/api-service/playground_client/configuration.py b/api-service/playground_client/configuration.py
index 9627f447f..2badb195b 100644
--- a/api-service/playground_client/configuration.py
+++ b/api-service/playground_client/configuration.py
@@ -71,7 +71,7 @@ class Configuration(object):
):
"""Constructor
"""
- self._base_path = "https://localhost:9001" if host is None else host
+ self._base_path = "https://localhost:49160" if host is None else host
"""Default Base url
"""
self.server_index = 0 if server_index is None and host is None else server_index
@@ -370,7 +370,7 @@ class Configuration(object):
"""
return [
{
- 'url': "https://localhost:9001",
+ 'url': "https://localhost:49160",
'description': "No description provided",
}
]
diff --git a/api-service/playground_client/docs/DefaultApi.md b/api-service/playground_client/docs/DefaultApi.md
index 0fcda3ae7..868dbe8d0 100644
--- a/api-service/playground_client/docs/DefaultApi.md
+++ b/api-service/playground_client/docs/DefaultApi.md
@@ -1,6 +1,6 @@
# playground_client.DefaultApi
-All URIs are relative to *https://localhost:9001*
+All URIs are relative to *https://localhost:49160*
Method | HTTP request | Description
------------- | ------------- | -------------
@@ -35,10 +35,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -100,10 +100,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -161,10 +161,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -222,10 +222,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -283,10 +283,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -342,10 +342,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -407,10 +407,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -468,10 +468,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -531,10 +531,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -592,10 +592,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -655,10 +655,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -720,10 +720,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -785,10 +785,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -846,10 +846,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -909,10 +909,10 @@ import os
import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
diff --git a/api-service/playground_client_README.md b/api-service/playground_client_README.md
index 440db2a36..ca8e14363 100644
--- a/api-service/playground_client_README.md
+++ b/api-service/playground_client_README.md
@@ -35,10 +35,10 @@ import playground_client
from playground_client.rest import ApiException
from pprint import pprint
-# Defining the host is optional and defaults to https://localhost:9001
+# Defining the host is optional and defaults to https://localhost:49160
# See configuration.py for a list of all supported configuration parameters.
configuration = playground_client.Configuration(
- host = "https://localhost:9001"
+ host = "https://localhost:49160"
)
@@ -62,7 +62,7 @@ with playground_client.ApiClient(configuration) as api_client:
## Documentation for API Endpoints
-All URIs are relative to *https://localhost:9001*
+All URIs are relative to *https://localhost:49160*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
diff --git a/api-service/session/session.py b/api-service/session/session.py
index 896052918..d83b8c47a 100644
--- a/api-service/session/session.py
+++ b/api-service/session/session.py
@@ -7,7 +7,7 @@ from session.env import EnvVar, format_env_vars
configuration = playground_client.Configuration(
- host="http://localhost:9001",
+ host="http://localhost:49160",
)
# Configuration for local server
@@ -17,6 +17,7 @@ configuration.cert_file = None
GetEnvs = Callable[[], Coroutine[Any, Any, List[EnvVar]]]
+
class Session:
def __init__(self, env_id: str, get_envs: GetEnvs):
self.client = playground_client.ApiClient(configuration)
diff --git a/components/Editor/Sidebar/index.tsx b/components/Editor/Sidebar/index.tsx
index fe16e6654..cb808cde7 100644
--- a/components/Editor/Sidebar/index.tsx
+++ b/components/Editor/Sidebar/index.tsx
@@ -1,9 +1,9 @@
-import { projects } from '@prisma/client'
import Link from 'next/link'
import { useEffect, useState } from 'react'
import clsx from 'clsx'
import useSWRMutation from 'swr/mutation'
+import { projects } from '@prisma/client'
import Text from 'components/Text'
import { Route, Block } from 'state/store'
import { useLatestDeployment } from 'hooks/useLatestDeployment'
@@ -20,7 +20,7 @@ export interface Props {
}
const apiHost = process.env.NODE_ENV === 'development'
- ? 'http://0.0.0.0:5000'
+ ? 'http://localhost:49155'
: 'https://ai-api-service-7d2cl2hooq-uc.a.run.app'
async function handlePostGenerate(url: string, { arg }: {
diff --git a/package.json b/package.json
index de3a46b35..20bf9f0f5 100644
--- a/package.json
+++ b/package.json
@@ -6,7 +6,7 @@
"dev": "npx concurrently -p none \"next dev\" \"yarn start:api\" \"yarn start:playground\"",
"dev:api-service": "npx concurrently \"yarn start:api\" \"yarn start:playground\"",
"build": "next build",
- "start:api": "cd api-service && PYTHONUNBUFFERED=1 exec poetry run python app.py",
+ "start:api": "cd api-service && QUART_APP=app:app PYTHONUNBUFFERED=1 poetry run quart --debug run --reload --port 49155",
"start:playground": "cd api-service/playground && yarn dev",
"install:api-service": "cd api-service && poetry install && cd playground && yarn",
"install:all": "yarn && yarn install:api-service",