restic-scheduler/utils.go

37 lines
613 B
Go
Raw Normal View History

2022-02-23 00:39:01 +00:00
package main
2022-02-23 22:13:00 +00:00
import "fmt"
2024-10-08 23:55:02 +00:00
func lineIn(needle string, haystack []string) bool {
for _, line := range haystack {
if line == needle {
return true
}
}
return false
}
2022-02-23 22:13:00 +00:00
func MergeEnvMap(parent, child map[string]string) map[string]string {
2022-02-23 00:55:41 +00:00
result := map[string]string{}
2022-02-23 00:39:01 +00:00
for key, value := range parent {
result[key] = value
}
for key, value := range child {
result[key] = value
}
2022-02-23 00:55:41 +00:00
return result
2022-02-23 00:39:01 +00:00
}
2022-02-23 22:13:00 +00:00
func EnvMapToList(envMap map[string]string) []string {
envList := []string{}
for name, value := range envMap {
envList = append(envList, fmt.Sprintf("%s=%s", name, value))
}
return envList
}