Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GenerateCmd = &cobra.Command{ Use: "generate", Short: "Generates application-properties based on the hierarchy and config provided", RunE: func(cmd *cobra.Command, args []string) error { resources, err := pkg.ReadResources(input) if err != nil { return err } logger.Infof("%d resources found from %s", len(resources), input) for _, r := range resources { logger.Debugf("%s", kommons.GetName(r.Item)) } buf, err := ioutil.ReadFile(configFile) if err != nil { return err } var config pkg.Config err = yaml.Unmarshal(buf, &config) if err != nil { return err } for _, name := range config.Applications { logger.Infof("[%s.properties]", name) hierarchy, err := pkg.GetHierarchy(configFile, name) if err != nil { return err } var file string if strings.ToLower(outputFileType) == "" || strings.ToLower(outputFileType) == "env" { file = hierarchy.GeneratePropertiesFile(resources) } if strings.ToLower(outputFileType) == "js" || strings.ToLower(outputFileType) == "javascript" { file = hierarchy.GenerateJsPropertiesFile(resources) } if outputType == "stdout" { fmt.Println(file) } else { filePath, err := text.Template(output, map[string]string{"name": name}) if err != nil { return err } if err := os.MkdirAll(path.Dir(filePath), 0755); err != nil { return err } if err := ioutil.WriteFile(filePath, []byte(file), 0644); err != nil { return err } } } return nil }, }
GenerateCmd represents the base command when called without any subcommands
View Source
var Operator = &cobra.Command{
Use: "operator",
Short: "Start the kubernetes operator",
Run: run,
}
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.