From 22016b4cc5534dacc8da15560209efea6b83e5e9 Mon Sep 17 00:00:00 2001 From: sharath <29162020+tnfssc@users.noreply.github.com> Date: Sat, 17 May 2025 22:49:50 +0000 Subject: [PATCH] chore(config): refactor sandbox image constants into common config --- backend/sandbox/sandbox.py | 3 ++- backend/utils/config.py | 4 ++++ setup.py | 15 ++++----------- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/backend/sandbox/sandbox.py b/backend/sandbox/sandbox.py index ec432e8d..5e7bc9b2 100644 --- a/backend/sandbox/sandbox.py +++ b/backend/sandbox/sandbox.py @@ -3,6 +3,7 @@ from daytona_api_client.models.workspace_state import WorkspaceState from dotenv import load_dotenv from utils.logger import logger from utils.config import config +from utils.config import Configuration load_dotenv() @@ -91,7 +92,7 @@ def create_sandbox(password: str, project_id: str = None): labels = {'id': project_id} params = CreateSandboxParams( - image="kortix/suna:0.1.2", + image=Configuration.SANDBOX_IMAGE_NAME, public=True, labels=labels, env_vars={ diff --git a/backend/utils/config.py b/backend/utils/config.py index a0f202dc..e08b3eab 100644 --- a/backend/utils/config.py +++ b/backend/utils/config.py @@ -158,6 +158,10 @@ class Configuration: STRIPE_PRODUCT_ID_PROD: str = 'prod_SCl7AQ2C8kK1CD' # Production product ID STRIPE_PRODUCT_ID_STAGING: str = 'prod_SCgIj3G7yPOAWY' # Staging product ID + # Sandbox configuration + SANDBOX_IMAGE_NAME = "kortix/suna:0.1.2" + SANDBOX_ENTRYPOINT = "/usr/bin/supervisord -n -c /etc/supervisor/conf.d/supervisord.conf" + @property def STRIPE_PRODUCT_ID(self) -> str: if self.ENV_MODE == EnvMode.STAGING: diff --git a/setup.py b/setup.py index da5d2c80..e7b3da52 100644 --- a/setup.py +++ b/setup.py @@ -1,19 +1,12 @@ #!/usr/bin/env python3 import os import sys -import json import time -import shutil import platform import subprocess -from pathlib import Path -import urllib.request -import configparser from getpass import getpass import re -import socket -import random -import string +from backend.utils.config import Configuration # ANSI colors for pretty output class Colors: @@ -201,9 +194,9 @@ def collect_daytona_info(): print_info("Then, generate an API key from 'Keys' menu") print_info("After that, go to Images (https://app.daytona.io/dashboard/images)") print_info("Click '+ Create Image'") - print_info("Enter 'kortix/suna:0.1.2' as the image name") - print_info("Set '/usr/bin/supervisord -n -c /etc/supervisor/conf.d/supervisord.conf' as the Entrypoint") - + print_info(f"Enter '{Configuration.SANDBOX_IMAGE_NAME}' as the image name") + print_info(f"Set '{Configuration.SANDBOX_ENTRYPOINT}' as the Entrypoint") + input("Press Enter to continue once you've completed these steps...") while True: