package flagset

import (
	"github.com/owncloud/ocis/ocis-pkg/flags"
	"github.com/owncloud/ocis/storage/pkg/config"
	"github.com/urfave/cli/v2"
)

// SecretWithConfig applies cfg to the root flagset
func SecretWithConfig(cfg *config.Config) []cli.Flag {
	return []cli.Flag{
		&cli.StringFlag{
			Name:        "jwt-secret",
			Value:       flags.OverrideDefaultString(cfg.Reva.JWTSecret, "Pive-Fumkiu4"),
			Usage:       "Shared jwt secret for reva service communication",
			EnvVars:     []string{"STORAGE_JWT_SECRET", "OCIS_JWT_SECRET"},
			Destination: &cfg.Reva.JWTSecret,
		},
	}
}
