From 794445b230ddad08480f35d58f4694023e5f7006 Mon Sep 17 00:00:00 2001 From: Max Resnick Date: Sun, 18 Feb 2024 08:46:42 -0800 Subject: fix: args/flags clean up, remove repobase from config --- cmd/main.go | 30 ++++++++++++++++++++---------- 1 file changed, 20 insertions(+), 10 deletions(-) (limited to 'cmd') diff --git a/cmd/main.go b/cmd/main.go index a0f007b..38c3724 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -13,20 +13,19 @@ import ( ) var ( - reposDir = *flag.String("r", "./repos", "Directory containing git repositories") - mgmtRepo = *flag.Bool("a", true, "mgmt repo used for configuration") - backendCommand = *flag.String("c", "git http-backend", "CGI binary to execute") - addr = *flag.String("l", ":8080", "Address/port to listen on") - modelPath = *flag.String("m", "./auth_model.ini", "Authentication model") - policyPath = *flag.String("p", "./policy.csv", "auth policy") - serverConfigPath = *flag.String("s", "/gitserver.yaml", "serverconfig path") - newToken = *flag.Bool("t", false, "make a new token") - // TODO what was my intent here? - // updatePolicies = flag.Bool("u", false, "update policies") + reposDir string + mgmtRepo bool + backendCommand string + addr string + modelPath string + policyPath string + serverConfigPath string + newToken bool ) func main() { flag.Parse() + print(reposDir) if newToken { token, hash, err := authz.GenerateNewToken() if err != nil { @@ -55,3 +54,14 @@ func main() { } log.Fatal(server.ListenAndServe()) } + +func init() { + flag.StringVar(&backendCommand, "c", "git http-backend", "CGI binary to execute") + flag.StringVar(&addr, "l", ":8080", "Address/port to listen on") + flag.StringVar(&modelPath, "m", "./auth_model.ini", "Authentication model") + flag.StringVar(&policyPath, "p", "./policy.csv", "auth policy") + flag.StringVar(&serverConfigPath, "s", "/gitserver.yaml", "serverconfig path") + flag.StringVar(&reposDir, "r", "./repos", "Directory containing git repositories") + flag.BoolVar(&mgmtRepo, "a", false, "mgmt repo used for configuration") + flag.BoolVar(&newToken, "t", false, "make a new token") +} -- cgit v1.2.3