cmd/tsidp: add --dir flag

To better control where the tsnet state is being stored.

Updates #10263

Signed-off-by: Maisem Ali <maisem@tailscale.com>
This commit is contained in:
Maisem Ali 2024-09-26 06:18:15 -07:00 committed by Maisem Ali
parent 096b090caf
commit fb0f8fc0ae

View File

@ -64,6 +64,7 @@ type ctxConn struct{
flagLocalPort = flag.Int("local-port", -1, "allow requests from localhost") flagLocalPort = flag.Int("local-port", -1, "allow requests from localhost")
flagUseLocalTailscaled = flag.Bool("use-local-tailscaled", false, "use local tailscaled instead of tsnet") 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") flagFunnel = flag.Bool("funnel", false, "use Tailscale Funnel to make tsidp available on the public internet")
flagDir = flag.String("dir", "", "tsnet state directory; a default one will be created if not provided")
) )
func main() { func main() {
@ -120,6 +121,7 @@ func main() {
} else { } else {
ts := &tsnet.Server{ ts := &tsnet.Server{
Hostname: "idp", Hostname: "idp",
Dir: *flagDir,
} }
if *flagVerbose { if *flagVerbose {
ts.Logf = log.Printf ts.Logf = log.Printf