1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
package main
import "flag"
// Args are commandline arguments
type Args struct {
RepoUrl string
RepoLocation string
Hostname string
DataDir string
AuthKey string
OauthId string
OauthSecret string
}
// Flags is the [flag.FlagSet] for tailpolicy
func Flags() (*Args, *flag.FlagSet) {
args := &Args{
DataDir: ".tsnet",
Hostname: "policy",
}
fs := flag.NewFlagSet("tailpolicy", flag.ExitOnError)
fs.StringVar(&args.RepoUrl, "repo-url", args.RepoUrl, "Repo URL for the Tailscale policy")
fs.StringVar(&args.RepoLocation, "repo-location", args.RepoLocation, "Repo location to perform git operations against")
fs.StringVar(&args.Hostname, "hostname", args.Hostname, "Tailnet hostname")
fs.StringVar(&args.DataDir, "data-dir", args.DataDir, "tsnet data directory")
fs.StringVar(&args.AuthKey, "auth-key", args.AuthKey, "tsnet auth key")
fs.StringVar(&args.OauthId, "oauth-id", args.OauthId, "Tailscale oauth ID")
fs.StringVar(&args.OauthSecret, "oauth-secret", args.OauthSecret, "Tailscale oauth secret")
return args, fs
}
|