Ejemplo n.º 1
0
func (d *daemon) Start() error {
	d.log.Println("Starting the daemon...")
	config := &configAPI{dmn: d}
	http.HandleFunc(config.Path(), api.API(config, d.log))
	//http.HandleFunc("/config/getall/", d.getAllConfig)

	d.log.Fatal(
		"Failed to start the daemon.",
		http.ListenAndServe(fmt.Sprintf("%s:%s", d.host, d.port), nil),
	)
	return nil
}
Ejemplo n.º 2
0
// configAPI returns the API handler.
func (d *daemon) configAPI() http.HandlerFunc {
	return api.API(&configAPI{dmn: d}, d.log)
}