Files
photoprism/internal/config/expand.go
2025-09-24 08:28:38 +02:00

18 lines
351 B
Go

package config
import (
"os"
)
// Vars represents a map of variable names to values.
type Vars = map[string]string
// ExpandVars replaces variables in the format ${NAME} with their corresponding values.
func ExpandVars(s string, vars Vars) string {
if s == "" {
return s
}
return os.Expand(s, func(key string) string { return vars[key] })
}