summaryrefslogtreecommitdiff
path: root/init.go
blob: a20b5d225d9354ec24732f01496d0a0fd805e552 (plain)
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
package ENV

// this is an experiment at this point to
// see how this turns out

func Init(appname, version, buildtime string, fromargv []string, goodFunc func(string), badFunc func(string, error)) error {
	APPNAME = appname
	VERSION = version
	BUILDTIME = buildtime
	argv = fromargv
	goodExit = goodFunc
	badExit = badFunc

	err := loadENV()
	if err == nil {
		envPB.Init = true
	}
	SetGlobal("lib/ENV", "APPNAME", APPNAME)
	SetGlobal("lib/ENV", "VERSION", VERSION)
	SetGlobal("lib/ENV", "BUILDTIME", BUILDTIME)
	return err
}

func InitValid() bool {
	if envPB == nil {
		// todo: track that the application did not init
		envPB = NewKeys()
		return false
	}
	return envPB.Init
}