Refactorisation to writers in generator package
This commit is contained in:
17
generator/writers/configmap.go
Normal file
17
generator/writers/configmap.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package writers
|
||||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
func BuildConfigMap(c interface{}, kind, servicename, name, templatesDir string) {
|
||||
fname := filepath.Join(templatesDir, servicename+"."+name+"."+kind+".yaml")
|
||||
fp, _ := os.Create(fname)
|
||||
enc := yaml.NewEncoder(fp)
|
||||
enc.SetIndent(2)
|
||||
enc.Encode(c)
|
||||
fp.Close()
|
||||
}
|
Reference in New Issue
Block a user