diff --git a/cmd/flags.go b/cmd/flags.go index 50bf6b3..240594e 100644 --- a/cmd/flags.go +++ b/cmd/flags.go @@ -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{ diff --git a/cmd/main.go b/cmd/main.go index 1830cef..2c4e03a 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -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