Move env var flag passing to Dockerfile

Updates #15465

Signed-off-by: Kot <kot@kot.pink>
This commit is contained in:
Kot
2025-04-01 21:53:10 -05:00
committed by Brad Fitzpatrick
parent 85bcc2e3bd
commit c86afacf26
3 changed files with 5 additions and 11 deletions
+2 -9
View File
@@ -65,17 +65,10 @@ var (
flagLocalPort = flag.Int("local-port", -1, "allow requests from localhost")
flagUseLocalTailscaled = flag.Bool("use-local-tailscaled", false, "use local tailscaled instead of tsnet")
flagFunnel = flag.Bool("funnel", false, "use Tailscale Funnel to make tsidp available on the public internet")
flagHostname = flag.String("hostname", envOr("TS_HOSTNAME", "idp"), "tsnet hostname to use instead of idp")
flagDir = flag.String("dir", envOr("TS_STATE_DIR", ""), "tsnet state directory; a default one will be created if not provided")
flagHostname = flag.String("hostname", "idp", "tsnet hostname to use instead of idp")
flagDir = flag.String("dir", "", "tsnet state directory; a default one will be created if not provided")
)
func envOr(key, defaultVal string) string {
if result, ok := os.LookupEnv(key); ok {
return result
}
return defaultVal
}
func main() {
flag.Parse()
ctx := context.Background()