Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

39 lines (33 sloc) 0.647 kB
package main
import(
"os"
"path/filepath"
"io/ioutil"
"encoding/json"
)
type Config map[string]string
func (c *Config) Set(key string, val string) {
(*c)[key] = val
}
func (c *Config) Is(key string) string {
if val, exists := (*c)[key]; exists {
return val
}
return ""
}
func (c *Config) Get(key string) string {
if val, exists := (*c)[key]; exists {
return val
}
return ""
}
func loadConfig() (config *Config) {
root, _ := filepath.Split(filepath.Clean(os.Args[0]))
b, err := ioutil.ReadFile(filepath.Join(root, "config.json"))
if err != nil {
panic(err)
return &Config{}
}
err = json.Unmarshal(b, &config)
return
}
Jump to Line
Something went wrong with that request. Please try again.