Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // RootCmd represents the base command when called without any subcommands RootCmd = &cobra.Command{ Use: "lift", Version: fmt.Sprintf("%s-%s (built by %s on %s)", version, gitTag, buildUser, buildDate), Short: "A cloud-init alternative for Alpine Linux", Long: `Lift performs initial OS configuration on first boot.`, Run: func(cmd *cobra.Command, args []string) { if viper.GetBool("debug") { log.SetLevel(log.DebugLevel) } if viper.GetBool("no-color") { logFormat = log.TextFormatter{ ForceColors: false, DisableColors: true, FullTimestamp: true, TimestampFormat: "2006-01-02T15:04:05.999999999", } } if viper.GetBool("json") { log.SetFormatter(&log.JSONFormatter{}) } headers := make(map[string][]string) for _, h := range viper.GetStringSlice("request-headers") { words := strings.SplitN(h, ":", 2) key := strings.TrimSpace(words[0]) value := strings.TrimSpace(words[1]) if key == "" || value == "" { log.Errorf("Invalid request header: %s", h) log.Error("Lift aborted") os.Exit(1) } headers[key] = append(headers[key], value) } lift, err := lift.New(viper.GetString("alpine-data-url"), headers) if err != nil { log.Error(err) log.Error("Lift aborted") os.Exit(1) } if err = lift.Start(); err != nil { log.Error(err) log.Error("Lift aborted") os.Exit(1) } }, } )
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.