bugfix: All previous entity files are removed when file is updated
This commit is contained in:
parent
f3934b1906
commit
0ec2e7069b
|
|
@ -150,6 +150,8 @@ func loadEntityFileYaml(filename string, entityname string) {
|
|||
func updateEvmFromFile(entityname string, data []map[string]string) {
|
||||
count := len(data)
|
||||
|
||||
sv.RemoveKeysThatStartWith("entities." + entityname)
|
||||
|
||||
sv.Contents["entities."+entityname+".count"] = fmt.Sprintf("%v", count)
|
||||
|
||||
for i, mapp := range data {
|
||||
|
|
|
|||
|
|
@ -27,3 +27,11 @@ func ReplaceEntityVars(prefix string, source string) string {
|
|||
|
||||
return source
|
||||
}
|
||||
|
||||
func RemoveKeysThatStartWith(search string) {
|
||||
for k, _ := range Contents {
|
||||
if strings.HasPrefix(k, search) {
|
||||
delete(Contents, k)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue