https://github.com/mashiike/ecsmeta
https://github.com/mashiike/ecsmeta
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/mashiike/ecsmeta
- Owner: mashiike
- License: mit
- Created: 2020-08-18T10:58:45.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-11-17T02:48:36.000Z (over 1 year ago)
- Last Synced: 2024-06-21T06:28:02.383Z (11 months ago)
- Language: Go
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ecsmeta
This is a utility module for getting ECS metadata.
Mainly used to embed ECS metadata in text/template (or http://github.com/kayac/go-config ).See below for ECS metadata.
https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task-metadata-endpoint.htmlThis respects https://github.com/fujiwara/tfstate-lookup.
## Usage (Go package)
See details in [godoc](https://godoc.org/github.com/mashiike/ecsmeta).
```go
package mainimport (
"log"
"os"
"strings"
"text/template""github.com/mashiike/ecsmeta"
)func main() {
const templateText = `Image: {{ecsmeta ".Containers[0].Image"}}`
funcMap := ecsmeta.MustFuncMap()tmpl, err := template.New("txt").Funcs(funcMap).Parse(templateText)
if err != nil {
log.Fatalf("parsing: %s", err)
}
err = tmpl.Execute(os.Stdout, nil)
if err != nil {
log.Fatalf("execution: %s", err)
}
}
```## LICENSE
[Mozilla Public License Version 2.0](LICENSE)