Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

fix(config): add env var migration for instance ports, enable screencast in tests

Bosche5901e648e7e
diff --git a/internal/config/config.go b/internal/config/config.go
index c8003f3e..a8f43ff3 100644
--- a/internal/config/config.go
+++ b/internal/config/config.go
@@ -389,8 +389,8 @@ func Load() *RuntimeConfig {
// Server defaults + env vars
Bind: envOrMigrate("PINCHTAB_BIND", "BRIDGE_BIND", "127.0.0.1"),
Port: envOrMigrate("PINCHTAB_PORT", "BRIDGE_PORT", "9867"),
- InstancePortStart: envIntOr("PINCHTAB_INSTANCE_PORT_START", 9868),
- InstancePortEnd: envIntOr("PINCHTAB_INSTANCE_PORT_END", 9968),
+ InstancePortStart: envIntOrMigrate("PINCHTAB_INSTANCE_PORT_START", "INSTANCE_PORT_START", 9868),
+ InstancePortEnd: envIntOrMigrate("PINCHTAB_INSTANCE_PORT_END", "INSTANCE_PORT_END", 9968),
CdpURL: os.Getenv("CDP_URL"),
Token: envMigrate("PINCHTAB_TOKEN", "BRIDGE_TOKEN"),
StateDir: envOrMigrate("PINCHTAB_STATE_DIR", "BRIDGE_STATE_DIR", userConfigDir()),
@@ -481,10 +481,10 @@ func applyFileConfig(cfg *RuntimeConfig, fc *FileConfig) {
if fc.Server.CdpURL != "" && os.Getenv("CDP_URL") == "" {
cfg.CdpURL = fc.Server.CdpURL
}
- if fc.Server.InstancePortStart != nil && os.Getenv("PINCHTAB_INSTANCE_PORT_START") == "" {
+ if fc.Server.InstancePortStart != nil && !envMigrateIsSet("PINCHTAB_INSTANCE_PORT_START", "INSTANCE_PORT_START") {
cfg.InstancePortStart = *fc.Server.InstancePortStart
}
- if fc.Server.InstancePortEnd != nil && os.Getenv("PINCHTAB_INSTANCE_PORT_END") == "" {
+ if fc.Server.InstancePortEnd != nil && !envMigrateIsSet("PINCHTAB_INSTANCE_PORT_END", "INSTANCE_PORT_END") {
cfg.InstancePortEnd = *fc.Server.InstancePortEnd
}
diff --git a/tests/testutil/server.go b/tests/testutil/server.go
index d4917a77..177377c3 100644
--- a/tests/testutil/server.go
+++ b/tests/testutil/server.go
@@ -52,10 +52,13 @@ func DefaultConfig() ServerConfig {
port = "19867"
}
return ServerConfig{
- Port: port,
- Headless: true,
- Stealth: "light",
- AllowEvaluate: true, // tests need evaluate for assertions
+ Port: port,
+ Headless: true,
+ Stealth: "light",
+ AllowEvaluate: true, // tests need evaluate for assertions
+ AllowDownload: true, // tests validate download error handling
+ AllowUpload: true, // tests validate upload error handling
+ AllowScreencast: true, // orchestrator uses /screencast/tabs to fetch tabs
}
}
@@ -124,6 +127,7 @@ func StartServer(cfg ServerConfig) (*Server, error) {
"PINCHTAB_STEALTH="+cfg.Stealth,
"PINCHTAB_STATE_DIR="+s.StateDir,
"PINCHTAB_PROFILE_DIR="+s.ProfileDir,
+ "PINCHTAB_CONFIG="+filepath.Join(s.Dir, "config.json"), // Isolate from host config
)
// Security flags from ServerConfig