feat: remove printing of default token
This commit is contained in:
parent
7de166765b
commit
cc20bdd289
|
@ -5,9 +5,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"forge.cadoles.com/cadoles/bouncer/internal/admin"
|
"forge.cadoles.com/cadoles/bouncer/internal/admin"
|
||||||
"forge.cadoles.com/cadoles/bouncer/internal/auth/jwt"
|
|
||||||
"forge.cadoles.com/cadoles/bouncer/internal/command/common"
|
"forge.cadoles.com/cadoles/bouncer/internal/command/common"
|
||||||
"forge.cadoles.com/cadoles/bouncer/internal/jwk"
|
|
||||||
"forge.cadoles.com/cadoles/bouncer/internal/setup"
|
"forge.cadoles.com/cadoles/bouncer/internal/setup"
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
@ -21,11 +19,6 @@ const (
|
||||||
func RunCommand() *cli.Command {
|
func RunCommand() *cli.Command {
|
||||||
flags := append(
|
flags := append(
|
||||||
common.Flags(),
|
common.Flags(),
|
||||||
&cli.BoolFlag{
|
|
||||||
Name: flagPrintDefaultToken,
|
|
||||||
Usage: "Generate and print a default writer token in console at startup",
|
|
||||||
Value: true,
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
|
|
||||||
return &cli.Command{
|
return &cli.Command{
|
||||||
|
@ -49,22 +42,6 @@ func RunCommand() *cli.Command {
|
||||||
|
|
||||||
defer flushSentry()
|
defer flushSentry()
|
||||||
|
|
||||||
if printDefaultToken := ctx.Bool(flagPrintDefaultToken); printDefaultToken {
|
|
||||||
key, err := jwk.Generate(jwk.DefaultKeySize)
|
|
||||||
if err != nil {
|
|
||||||
return errors.Wrap(err, "could not generate default key")
|
|
||||||
}
|
|
||||||
|
|
||||||
token, err := jwt.GenerateToken(ctx.Context, key, string(conf.Admin.Auth.Issuer), "default-admin", jwt.Role(jwt.RoleWriter))
|
|
||||||
if err != nil {
|
|
||||||
return errors.WithStack(err)
|
|
||||||
}
|
|
||||||
|
|
||||||
logger.SetLevel(logger.LevelInfo)
|
|
||||||
logger.Info(ctx.Context, "default writer token", logger.F("token", token))
|
|
||||||
logger.SetLevel(logger.Level(conf.Logger.Level))
|
|
||||||
}
|
|
||||||
|
|
||||||
integrations, err := setup.SetupIntegrations(ctx.Context, conf)
|
integrations, err := setup.SetupIntegrations(ctx.Context, conf)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.Wrap(err, "could not setup integrations")
|
return errors.Wrap(err, "could not setup integrations")
|
||||||
|
|
Loading…
Reference in New Issue