Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var InitCommand = &cobra.Command{ Use: "init", Short: "Initialize your kl-config file with some sample values", Long: `kl init This command initialize a kl-config. Examples: # Initialize the kl-config file kl init `, Run: func(cmd *cobra.Command, _ []string) { pName := fn.ParseStringFlag(cmd, "project") aName := fn.ParseStringFlag(cmd, "account") filePath := fn.ParseKlFile(cmd) initFile, err := client.GetKlFile(filePath) if err != nil { acc, err := server.EnsureAccount( fn.MakeOption("accountName", aName), ) if err != nil { fn.PrintError(err) return } p, err := server.SelectProject(pName) if err != nil { fn.PrintError(err) return } envs, err := server.ListEnvs(fn.MakeOption("projectName", p.Metadata.Name)) if err != nil { fn.PrintError(err) return } defEnv := "" if len(envs) != 0 { defEnv = envs[0].Metadata.Name } initFile = &client.KLFileType{ Version: "v1", Project: fmt.Sprintf("%s/%s", acc, p.Metadata.Name), DefaultEnv: defEnv, Mres: make([]client.ResType, 0), Configs: make([]client.ResType, 0), Secrets: make([]client.ResType, 0), Env: []client.EnvType{{Key: "SAMPLE_ENV", Value: "sample_value"}}, FileMount: client.MountType{ MountBasePath: "./.mounts", Mounts: make([]client.FileEntry, 0), }, } if defEnv == "" { fn.Warn("No environment found for the project, Please create environments from dashboard\n") } else { fn.Log("Default env set to: ", defEnv) } } else { fn.Log("file already present \n") } if err = client.WriteKLFile(*initFile); err != nil { fn.PrintError(err) return } fn.Log("Initialized file ", client.GetConfigPath()) }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.