-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathusage.go
More file actions
47 lines (30 loc) · 1.08 KB
/
usage.go
File metadata and controls
47 lines (30 loc) · 1.08 KB
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
45
46
47
package main
import (
"fmt"
)
func usage() {
fmt.Println(`
USAGE:
Envsub app is a simple tool which use golang template engine to modify pointed files.
If template file name contains .tmpl suffix it will be removed after parsing template.
example1.conf.tmpl => example1.conf
1. Use env variables for templates
In template file use following placeholder
to replace it with corresponding env variable
EXAMPLE:
envsub file.tmpl --envs
2. Use extra values
Prepare json values:
{"rootValue":{"firstLevel":{"secondLevel":{"key1":"value1","key2":["listel1","listel2"]}}}}
Export it as env variable:
export JSON_ENV_VARIABLE_NAME={"rootValue":{"firstLevel":{"secondLevel":{"key1":"value1","key2":["listel1","listel2"]}}}}
In template file use following placeholder
to replace it with corresponding json key (value1 in this case)
EXAMPLE:
envsub file.tmpl -e JSON_ENV_VARIABLE_NAME
3. Use yaml configuration file
EXAMPLE:
envsub file.tmpl -f config.yaml
`)
fmt.Printf("\n")
}