Fix start_forge_app in scripts (#4171)
This commit is contained in:
committed by
GitHub
parent
ae95b8dd35
commit
d22b98a381
@@ -3,7 +3,8 @@ from datetime import timedelta
|
||||
|
||||
import typer
|
||||
|
||||
from skyvern.forge.app import DATABASE
|
||||
from skyvern.forge import app
|
||||
from skyvern.forge.forge_app_initializer import start_forge_app
|
||||
from skyvern.forge.sdk.core import security
|
||||
from skyvern.forge.sdk.schemas.organizations import OrganizationAuthToken, OrganizationAuthTokenType
|
||||
|
||||
@@ -20,7 +21,7 @@ async def create_org_api_token(org_id: str) -> OrganizationAuthToken:
|
||||
The API token created for the specified org_id.
|
||||
"""
|
||||
# get the organization
|
||||
organization = await DATABASE.get_organization(org_id)
|
||||
organization = await app.DATABASE.get_organization(org_id)
|
||||
if not organization:
|
||||
raise Exception(f"Organization id {org_id} not found")
|
||||
|
||||
@@ -30,7 +31,7 @@ async def create_org_api_token(org_id: str) -> OrganizationAuthToken:
|
||||
expires_delta=API_KEY_LIFETIME,
|
||||
)
|
||||
# generate OrganizationAutoToken
|
||||
org_auth_token = await DATABASE.create_org_auth_token(
|
||||
org_auth_token = await app.DATABASE.create_org_auth_token(
|
||||
organization_id=org_id,
|
||||
token=api_key,
|
||||
token_type=OrganizationAuthTokenType.api,
|
||||
@@ -40,6 +41,7 @@ async def create_org_api_token(org_id: str) -> OrganizationAuthToken:
|
||||
|
||||
|
||||
def main(org_id: str) -> None:
|
||||
start_forge_app()
|
||||
asyncio.run(create_org_api_token(org_id))
|
||||
|
||||
|
||||
|
||||
@@ -4,11 +4,12 @@ from typing import Annotated, Optional
|
||||
import typer
|
||||
|
||||
from scripts.create_api_key import create_org_api_token
|
||||
from skyvern.forge.app import DATABASE
|
||||
from skyvern.forge import app
|
||||
from skyvern.forge.forge_app_initializer import start_forge_app
|
||||
|
||||
|
||||
async def create_org(org_name: str, webhook_callback_url: str | None = None) -> None:
|
||||
organization = await DATABASE.create_organization(org_name, webhook_callback_url)
|
||||
organization = await app.DATABASE.create_organization(org_name, webhook_callback_url)
|
||||
print(f"Created organization: {organization}")
|
||||
await create_org_api_token(organization.organization_id)
|
||||
|
||||
@@ -17,6 +18,7 @@ def main(
|
||||
org_name: str,
|
||||
webhook_callback_url: Annotated[Optional[str], typer.Argument()] = None,
|
||||
) -> None:
|
||||
start_forge_app()
|
||||
asyncio.run(create_org(org_name, webhook_callback_url))
|
||||
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import requests
|
||||
from dotenv import load_dotenv
|
||||
|
||||
from skyvern.forge import app
|
||||
from skyvern.forge.forge_app_initializer import start_forge_app
|
||||
from skyvern.forge.sdk.schemas.tasks import TaskRequest
|
||||
|
||||
# Skip tests if network access is not available
|
||||
@@ -283,6 +284,8 @@ def print_help() -> None:
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
start_forge_app()
|
||||
|
||||
print("Browser Sessions Testing CLI")
|
||||
print("Type 'help' for available commands")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user