INNER CODE UNIT · Python

lifespan

TheAgenticAI/CortexON · ta-browser/core/server/main.py:26

async def lifespan(app: FastAPI):
    # Startup: create default namespace from environment variable
    namespace = os.environ.get("VITE_APP_VA_NAMESPACE")
    if namespace:
        try:
            # Check if namespace already exists
            existing_namespaces = await vault_ops.list_ns()
            if f"{namespace}/" in existing_namespaces:
                logger.info(f"Namespace {namespace} already exists, skipping creation")
            else:
                logger.info(f"Creating default namespace: {namespace}")
                await vault_ops.setup_user(namespace)
                logger.info(f"Default namespace created successfully: {namespace}")
        except Exception as e:
            logger.error(f"Failed to create default namespace: {str(e)}")
    yield

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…