mirror of
https://github.com/photoprism/photoprism.git
synced 2026-01-23 02:24:24 +00:00
17 lines
351 B
Go
17 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] })
|
|
}
|