bootstrap

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:  "bootstrap",
	Usage: "Register this client to the kmgm HTTPS/gRPC server",
	Flags: []cli.Flag{},
	Action: func(c *cli.Context) error {
		env := action.GlobalEnvironment
		slog := env.Logger.Sugar()

		if env.ProfileName != storage.DefaultProfileName &&
			env.ProfileName != authprofile.ProfileName {
			slog.Warnf("Specified --profile %q setting is ignored in bootstrap cmd.", env.ProfileName)
		}
		env.ProfileName = authprofile.ProfileName

		if err := env.EnsureClientConn(c.Context); err != nil {
			return err
		}
		if err := IssueCertPair(c.Context, env); err != nil {
			return err
		}

		env.ConnectionInfo.AccessToken = ""
		env.ConnectionInfo.ClientCertificateFile = env.Storage.ClientCertPath()
		env.ConnectionInfo.ClientPrivateKeyFile = env.Storage.ClientPrivateKeyPath()

		if err := env.SaveConnectionInfo(); err != nil {
			return err
		}

		return nil
	},
}

Functions

func EnsureKey

func EnsureKey(env *action.Environment) (crypto.PrivateKey, error)

func IssueCertPair

func IssueCertPair(ctx context.Context, env *action.Environment) error

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL