diff options
Diffstat (limited to 'context.go')
| -rw-r--r-- | context.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/context.go b/context.go new file mode 100644 index 00000000..939883ea --- /dev/null +++ b/context.go @@ -0,0 +1,20 @@ +package main + +import ( + "os" + "strings" +) + +// Context for templates +type Context struct { +} + +// Env - Map environment variables for use in a template +func (c *Context) Env() map[string]string { + env := make(map[string]string) + for _, i := range os.Environ() { + sep := strings.Index(i, "=") + env[i[0:sep]] = i[sep+1:] + } + return env +} |
