-
Notifications
You must be signed in to change notification settings - Fork 0
/
files.go
44 lines (38 loc) · 1.04 KB
/
files.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package configo
import (
"strings"
)
var orderedTemplates = []string{
`default`,
`default-{instance}`,
`{deployment}`,
`{deployment}-{instance}`,
`{shortHostname}`,
`{shortHostname}-{instance}`,
`{shortHostname}-{deployment}`,
`{shortHostname}-{deployment}-{instance}`,
`{fullHostname}`,
`{fullHostname}-{instance}`,
`{fullHostname}-{deployment}`,
`{fullHostname}-{deployment}-{instance}`,
`local`,
`local-{instance}`,
`local-{deployment}`,
`local-{deployment}-{instance}`,
}
const envFileName = "env"
var defaultProviders = map[string]Provider{
".yaml": yamlProvider,
".yml": yamlProvider,
".json": jsonProvider,
".json5": json5Provider,
".hjson": hjsonProvider,
".toml": tomlProvider,
}
func getExpectedBasename(tmpl string, env environment) (ret string) {
ret = strings.Replace(tmpl, "{deployment}", env.deployment, 1)
ret = strings.Replace(ret, "{instance}", env.instance, 1)
ret = strings.Replace(ret, "{shortHostname}", env.shortHostname, 1)
ret = strings.Replace(ret, "{fullHostname}", env.fullHostname, 1)
return ret
}