diff options
| author | Max Resnick <max@ofmax.li> | 2024-02-18 08:46:42 -0800 |
|---|---|---|
| committer | Max Resnick <max@ofmax.li> | 2024-02-18 08:46:42 -0800 |
| commit | 794445b230ddad08480f35d58f4694023e5f7006 (patch) | |
| tree | 544f5d5c8efbf02badca311cba6828c3f0fd0356 /cmd | |
| parent | a889ec1d68eb4af4329890bd0de1d4a5282f3ac3 (diff) | |
| download | go-git-server-794445b230ddad08480f35d58f4694023e5f7006.tar.gz | |
fix: args/flags clean up, remove repobase from config
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/main.go | 30 |
1 files changed, 20 insertions, 10 deletions
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") +} |