Expand replace express with values.
(content string)
| 46 | |
| 47 | // Expand replace express with values. |
| 48 | func (e ExprVars) Expand(content string) string { |
| 49 | if e.vars == nil { |
| 50 | e.vars = make(map[string]string) |
| 51 | } |
| 52 | |
| 53 | for key, value := range e.vars { |
| 54 | content = strings.ReplaceAll(content, fmt.Sprintf("${%s}", key), value) |
| 55 | content = strings.ReplaceAll(content, fmt.Sprintf("$%s", key), value) |
| 56 | content = e.replaceEnvVars(content) |
| 57 | } |
| 58 | |
| 59 | return content |
| 60 | } |
| 61 | |
| 62 | // replaceEnvVars replace env express with env value. |
| 63 | func (e ExprVars) replaceEnvVars(content string) string { |
no test coverage detected