usage of ctx.StringSlice and cli.StringSliceFlag

rename param pages-branches with pages-branch
This commit is contained in:
Simon Vieille 2022-11-11 17:12:16 +01:00
parent 06bde50161
commit 5db46e99fe
No known key found for this signature in database
GPG key ID: 579388D585F70417
2 changed files with 7 additions and 6 deletions

View file

@ -15,11 +15,11 @@ var ServeFlags = []cli.Flag{
Value: "codeberg.page",
},
// Default branches to fetch assets from
&cli.StringFlag{
Name: "pages-branches",
Usage: "defines branches to fetch assets from",
&cli.StringSliceFlag{
Name: "pages-branch",
Usage: "define a branch to fetch assets from",
EnvVars: []string{"PAGES_BRANCHES"},
Value: "pages",
Value: &cli.StringSlice{},
},
// GiteaRoot specifies the root URL of the Gitea instance, without a trailing slash.
&cli.StringFlag{

View file

@ -48,11 +48,10 @@ func Serve(ctx *cli.Context) error {
giteaAPIToken := ctx.String("gitea-api-token")
rawDomain := ctx.String("raw-domain")
mainDomainSuffix := []byte(ctx.String("pages-domain"))
defaultBranches := strings.Split(strings.ReplaceAll(ctx.String("pages-branches"), " ", ""), ",")
defaultBranches := ctx.StringSlice("pages-branch")
rawInfoPage := ctx.String("raw-info-page")
listeningAddress := fmt.Sprintf("%s:%s", ctx.String("host"), ctx.String("port"))
enableHTTPServer := ctx.Bool("enable-http-server")
acmeAPI := ctx.String("acme-api-endpoint")
acmeMail := ctx.String("acme-email")
acmeUseRateLimits := ctx.Bool("acme-use-rate-limits")
@ -78,6 +77,8 @@ func Serve(ctx *cli.Context) error {
defaultBranches = []string{"pages"}
}
fmt.Printf("%+v\n", defaultBranches)
keyCache := cache.NewKeyValueCache()
challengeCache := cache.NewKeyValueCache()
// canonicalDomainCache stores canonical domains