Sketch "inception" support.
I wanted to tell Sketch-in-container to run
go run ./cmd/sketch -unsafe -skaband-addr= -one-shot 'what is todays date'"
and have it work. And now it does.
The underlying complexity is whether "inDocker" is enough to know
"isInsideSketch", so I separated that as far as necessary. The skaband
stuff is still complicated.
It might be preferable to use env variables for all outside->inside
communication rather than use flags sometimes and variables sometimes
(like, for keys), but here we are.
diff --git a/cmd/sketch/main.go b/cmd/sketch/main.go
index 8ea4b65..ae029f9 100644
--- a/cmd/sketch/main.go
+++ b/cmd/sketch/main.go
@@ -117,6 +117,7 @@
if _, err := os.Stat("/.dockerenv"); err == nil {
inDocker = true
}
+ inInsideSketch := inDocker && *outsideHostname != ""
if !inDocker {
msgs, err := hostReqsCheck(*unsafe)
@@ -256,7 +257,7 @@
return err
}
- if !inDocker {
+ if !inInsideSketch {
ini := loop.AgentInit{
WorkingDir: wd,
}
@@ -283,7 +284,7 @@
ps1URL = fmt.Sprintf("http://%s", ln.Addr())
}
- if inDocker {
+ if inInsideSketch {
<-agent.Ready()
if ps1URL == "" {
ps1URL = agent.URL()