// Returns packet receiver object func NewWorkerReceiver(storage storage.Storage) *WorkerReceiver { addr, err := config.Instance().String("receiver", "addr") cli.CheckError(err) reader, err := gelf.NewReader(addr) cli.CheckError(err) return &WorkerReceiver{ storage: storage, reader: reader, } }
func initConfig(paths []string) { if len(paths) == 1 { once.Do(func() { var err error conf, err = c.ReadDefault(paths[0]) hc.CheckError(err) }) } }
// Returns HTTP server object func NewWorkerHttp(storage storage.Storage) *WorkerHttp { addr, err := config.Instance().String("http", "addr") cli.CheckError(err) maxPerPage, err := config.Instance().Int("http", "max_per_page") if err != nil || maxPerPage <= 0 { maxPerPage = 100 } maxResults, err := config.Instance().Int("http", "max_results") if err != nil || maxPerPage <= 0 { maxResults = 1000 } return &WorkerHttp{ addr: addr, maxPerPage: maxPerPage, maxResults: maxResults, storage: storage, } }