Sync script

This commit is contained in:
2015-03-29 00:06:01 +07:00
parent 71f5781c86
commit 86d503d622
3 changed files with 41 additions and 8 deletions
+9 -8
View File
@@ -22,20 +22,16 @@ type (
)
var (
path string
conf Config
)
// Config is immutable and is always returned by value
func C() Config {
return conf
func init() {
flag.StringVar(&path, "config", "config.json", "Path to configuration file")
}
func init() {
func Load() {
var err error
var path string
flag.StringVar(&path, "config", "config.json", "Path to configuration file")
flag.Parse()
var fd *os.File
if fd, err = os.Open(path); err != nil {
panic(err)
@@ -51,3 +47,8 @@ func init() {
log.SetOutput(os.Stderr)
log.SetFlags(log.Ldate | log.Ltime)
}
// Config is immutable and is always returned by value
func C() Config {
return conf
}