예제 #1
0
// 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,
	}
}
예제 #2
0
func initConfig(paths []string) {
	if len(paths) == 1 {
		once.Do(func() {
			var err error

			conf, err = c.ReadDefault(paths[0])
			hc.CheckError(err)
		})
	}
}
예제 #3
0
파일: http.go 프로젝트: endeveit/recause
// 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,
	}
}