mirror of
https://github.com/Comfy-Org/ComfyUI.git
synced 2026-08-26 19:02:36 +08:00
feat(assets): add --disable-assets flag to turn the assets system off
With --enable-assets removed and the assets system always on, there is no supported way to run without it. Add an explicit opt-out for the rollout bake period: cloud multi-tenant sidecars need a guaranteed off-switch, and QA needs a clean-fallback configuration. When --disable-assets is passed: - asset API routes are registered but disabled, returning a structured 503 - database initialization is skipped entirely (no sqlite file is created; the database currently has no non-asset users) - the background seeder is disabled, covering startup, /object_info and post-execution enrich scans, and output registration - workflow output enrichment and /upload/image asset registration are skipped - the assets feature flag reports false, and supports_model_type_tags follows it since model_type tags are an assets-API capability The hidden --enable-assets no-op remains accepted for launcher compatibility; --disable-assets takes precedence since the former gates nothing.
This commit is contained in:
38
server.py
38
server.py
@@ -253,7 +253,12 @@ class PromptServer():
|
||||
else args.front_end_root
|
||||
)
|
||||
logging.info(f"[Prompt Server] web root: {self.web_root}")
|
||||
register_assets_routes(self.app, self.user_manager)
|
||||
if args.disable_assets:
|
||||
# Register the routes without enabling them so /api/assets/* returns
|
||||
# a structured 503 rather than a 404.
|
||||
register_assets_routes(self.app)
|
||||
else:
|
||||
register_assets_routes(self.app, self.user_manager)
|
||||
routes = web.RouteTableDef()
|
||||
self.routes = routes
|
||||
self.last_node_id = None
|
||||
@@ -435,21 +440,22 @@ class PromptServer():
|
||||
|
||||
resp = {"name" : filename, "subfolder": subfolder, "type": image_upload_type}
|
||||
|
||||
try:
|
||||
tag = image_upload_type if image_upload_type in ("input", "output") else "input"
|
||||
tags = [tag]
|
||||
tags.extend(get_known_subfolder_tags(subfolder))
|
||||
result = register_file_in_place(abs_path=filepath, name=filename, tags=tags)
|
||||
resp["asset"] = {
|
||||
"id": result.ref.id,
|
||||
"name": result.ref.name,
|
||||
"asset_hash": result.asset.hash,
|
||||
"size": result.asset.size_bytes,
|
||||
"mime_type": result.asset.mime_type,
|
||||
"tags": result.tags,
|
||||
}
|
||||
except Exception:
|
||||
logging.warning("Failed to register uploaded image as asset", exc_info=True)
|
||||
if not args.disable_assets:
|
||||
try:
|
||||
tag = image_upload_type if image_upload_type in ("input", "output") else "input"
|
||||
tags = [tag]
|
||||
tags.extend(get_known_subfolder_tags(subfolder))
|
||||
result = register_file_in_place(abs_path=filepath, name=filename, tags=tags)
|
||||
resp["asset"] = {
|
||||
"id": result.ref.id,
|
||||
"name": result.ref.name,
|
||||
"asset_hash": result.asset.hash,
|
||||
"size": result.asset.size_bytes,
|
||||
"mime_type": result.asset.mime_type,
|
||||
"tags": result.tags,
|
||||
}
|
||||
except Exception:
|
||||
logging.warning("Failed to register uploaded image as asset", exc_info=True)
|
||||
|
||||
return web.json_response(resp)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user