package main import ( "gopkg.in/ini.v1" ) func parseconfig(file string) error { cfg, err := ini.Load(file) if err != nil { return err } conf.listen = cfg.Section("marisa").Key("listen").String() conf.user = cfg.Section("marisa").Key("user").String() conf.group = cfg.Section("marisa").Key("group").String() conf.baseuri = cfg.Section("www").Key("baseuri").String() conf.filepath = cfg.Section("www").Key("filepath").String() conf.metapath = cfg.Section("www").Key("metapath").String() conf.filectx = cfg.Section("www").Key("filectx").String() conf.rootdir = cfg.Section("www").Key("rootdir").String() conf.chroot = cfg.Section("marisa").Key("chroot").String() conf.tmplpath = cfg.Section("www").Key("tmplpath").String() conf.maxsize, _ = cfg.Section("www").Key("maxsize").Int64() conf.expiry, _ = cfg.Section("www").Key("expiry").Int64() return nil }