fix(cloudflare): fix delete_tunnel subdomain format and add startup config check
- Fix delete_tunnel calls to use correct subdomain format (instance-{id[:8]})
- Add Cloudflare configuration check at startup with clear warnings
- Help diagnose why tunnels aren't being created
This commit is contained in:
@@ -489,7 +489,7 @@ async def stop_instance(
|
|||||||
try:
|
try:
|
||||||
await delete_tunnel(
|
await delete_tunnel(
|
||||||
tunnel_id=instance.tunnel_id,
|
tunnel_id=instance.tunnel_id,
|
||||||
subdomain=f"instance-{instance.id}",
|
subdomain=f"instance-{str(instance.id)[:8]}",
|
||||||
)
|
)
|
||||||
logger.info("Deleted tunnel for instance %s", instance.id)
|
logger.info("Deleted tunnel for instance %s", instance.id)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
@@ -546,7 +546,7 @@ async def restart_instance(
|
|||||||
try:
|
try:
|
||||||
await delete_tunnel(
|
await delete_tunnel(
|
||||||
tunnel_id=instance.tunnel_id,
|
tunnel_id=instance.tunnel_id,
|
||||||
subdomain=f"instance-{instance.id}",
|
subdomain=f"instance-{str(instance.id)[:8]}",
|
||||||
)
|
)
|
||||||
logger.info("Deleted old tunnel for instance %s", instance.id)
|
logger.info("Deleted old tunnel for instance %s", instance.id)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
@@ -634,7 +634,7 @@ async def delete_instance(
|
|||||||
try:
|
try:
|
||||||
await delete_tunnel(
|
await delete_tunnel(
|
||||||
tunnel_id=instance.tunnel_id,
|
tunnel_id=instance.tunnel_id,
|
||||||
subdomain=f"instance-{instance.id}",
|
subdomain=f"instance-{str(instance.id)[:8]}",
|
||||||
)
|
)
|
||||||
logger.info("Deleted tunnel for instance %s", instance.id)
|
logger.info("Deleted tunnel for instance %s", instance.id)
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
|
|||||||
@@ -229,6 +229,18 @@ async def on_startup():
|
|||||||
|
|
||||||
# Seed built-in data
|
# Seed built-in data
|
||||||
await seed_builtin_tool_types()
|
await seed_builtin_tool_types()
|
||||||
|
|
||||||
|
# Check Cloudflare configuration
|
||||||
|
settings = Settings()
|
||||||
|
if settings.cloudflare_api_token and settings.cloudflare_account_id and settings.cloudflare_zone_id and settings.cloudflare_base_domain:
|
||||||
|
logger.info("Cloudflare tunnel configuration detected: base_domain=%s", settings.cloudflare_base_domain)
|
||||||
|
else:
|
||||||
|
logger.warning(
|
||||||
|
"Cloudflare tunnel configuration incomplete. "
|
||||||
|
"Tunnels will not be created. Set CLOUDFLARE_API_TOKEN, "
|
||||||
|
"CLOUDFLARE_ACCOUNT_ID, CLOUDFLARE_ZONE_ID, and CLOUDFLARE_BASE_DOMAIN."
|
||||||
|
)
|
||||||
|
|
||||||
logger.info("Startup complete.")
|
logger.info("Startup complete.")
|
||||||
|
|
||||||
app.include_router(health_router)
|
app.include_router(health_router)
|
||||||
|
|||||||
Reference in New Issue
Block a user