mirror of
https://github.com/photoprism/photoprism.git
synced 2025-09-27 05:08:13 +08:00
18 lines
351 B
Go
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] })
|
|
}
|