Last change
on this file since 80 was 80, checked in by Izuru Yakumo, 18 months ago |
A good time to finally release a stable version
Signed-off-by: Izuru Yakumo <yakumo.izuru@…>
|
File size:
492 bytes
|
Line | |
---|
1 | // globals returns list of global OS environment variables that start
|
---|
2 | // with AYA_ prefix as Vars, so the values can be used inside templates
|
---|
3 | package main
|
---|
4 |
|
---|
5 | import (
|
---|
6 | "os"
|
---|
7 | "strings"
|
---|
8 | )
|
---|
9 |
|
---|
10 | func globals() Vars {
|
---|
11 | vars := Vars{}
|
---|
12 | for _, e := range os.Environ() {
|
---|
13 | pair := strings.Split(e, "=")
|
---|
14 | if strings.HasPrefix(pair[0], "AYA_") {
|
---|
15 | vars[strings.ToLower(pair[0][3:])] = pair[1]
|
---|
16 | }
|
---|
17 | }
|
---|
18 | return vars
|
---|
19 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.