-
Notifications
You must be signed in to change notification settings - Fork 447
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Config template and telemetry fixes (#377)
- Loading branch information
Showing
7 changed files
with
65 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -89,4 +89,4 @@ volumes: | |
zep-db: | ||
networks: | ||
zep-network: | ||
driver: bridge | ||
driver: bridge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package config | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"strings" | ||
"text/template" | ||
) | ||
|
||
func parseConfigTemplate(data []byte) ([]byte, error) { //nolint:unused // this is only called in CE | ||
var missingVars []string | ||
|
||
tmpl, err := template.New("config").Funcs(template.FuncMap{ | ||
"Env": func(key string) string { | ||
val := os.Getenv(key) | ||
if val == "" { | ||
missingVars = append(missingVars, key) | ||
} | ||
|
||
return val | ||
}, | ||
}).Parse(string(data)) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
var result strings.Builder | ||
|
||
err = tmpl.Execute(&result, nil) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
if len(missingVars) > 0 { | ||
return nil, fmt.Errorf("missing environmentvariables: %s", strings.Join(missingVars, ", ")) | ||
} | ||
|
||
return []byte(result.String()), nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters