diff options
| author | Max Resnick <max@ofmax.li> | 2024-03-19 22:38:28 -0700 |
|---|---|---|
| committer | Max Resnick <max@ofmax.li> | 2024-03-23 21:31:46 -0700 |
| commit | d82129052e1c99a61abce7c34ea83f508737eeb9 (patch) | |
| tree | e8998eb745d8bc62f44155c7a9233542947b07e7 /cmd | |
| parent | 20090584fba4f893ea7e6a13057615a3ac2bc9c4 (diff) | |
| download | go-git-server-d82129052e1c99a61abce7c34ea83f508737eeb9.tar.gz | |
feat: handle a fresh start using a mgmt repo
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/main.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cmd/main.go b/cmd/main.go index 84d2fa0..9f1292f 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -20,6 +20,7 @@ var ( modelPath string policyPath string serverConfigPath string + tokenFilePath string newToken bool ) @@ -36,7 +37,7 @@ func main() { adminSvc := admin.NewService(modelPath, policyPath, serverConfigPath, reposDir, mgmtRepo) adminSvc.InitServer() tokens := authz.NewTokenMap() - err := tokens.LoadTokensFromFile("./tokens.csv") + err := tokens.LoadTokensFromFile(tokenFilePath) if err != nil { log.Fatal(err) } @@ -57,10 +58,11 @@ func main() { 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(&modelPath, "m", "./auth_model.ini", "casbin authentication model") + flag.StringVar(&policyPath, "p", "./policy.csv", "casbin auth policy") + flag.StringVar(&tokenFilePath, "t", "./tokens.csv", "casbin auth policy") + flag.StringVar(&serverConfigPath, "s", "./gitserver.yaml", "serverconfig path, this should be relative to the git root or absolute if not using mgmt repo") 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") + flag.BoolVar(&newToken, "g", false, "make a new token") } |