setup

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2019 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:  "setup",
	Usage: "Setup Komagome PKI",
	Flags: append(structflags.MustPopulateFlagsFromStruct(setup.Config{}),
		&cli.BoolFlag{
			Name:  "dump-template",
			Usage: "dump configuration template yaml without making actual changes",
		},
	),
	Action: func(c *cli.Context) error {
		env := wcli.GlobalEnvironment
		slog := env.Logger.Sugar()

		cfg, err := setup.DefaultConfig()
		if c.Bool("dump-template") {
			if err := frontend.DumpTemplate(configTemplateText, cfg); err != nil {
				return err
			}
			return nil
		}

		if err != nil {
			slog.Debugf("Errors encountered while constructing default config: %v", err)
		}

		if err := structflags.PopulateStructFromCliContext(cfg, c); err != nil {
			return err
		}

		profile, err := env.Profile()
		if err != nil {
			return err
		}

		if err := EnsureCA(env, cfg, profile); err != nil {
			return err
		}

		return nil
	},
}

Functions

func EnsureCA

func EnsureCA(env *wcli.Environment, cfg *setup.Config, profile *storage.Profile) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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