func NewServer(config string) (*Server, error) {
	s := &Server{handler: NewReverseProxy()}
	err := s.ReadConfig(config, true)
	if err != nil {
		return nil, err
	}
	if s.Config.WatchConfig {
		watcher, err := fsnotify.NewWatcher()
		if err != nil {
			return nil, err
		}
		err = watcher.Add(config)
		if err != nil {
			return nil, err
		}
		log.Println("Watching", config)
		go func() {
			exit := shutdown.First()
			for {
				select {
				case event := <-watcher.Events:
					switch event.Op {
					case fsnotify.Rename:
						watcher.Remove(event.Name)
						watcher.Add(config)
					case fsnotify.Remove:
						continue
					}
					log.Println("Reloading configuration")
					err := s.ReadConfig(event.Name, false)
					if err != nil {
						log.Println("Error reloading configuration:", err)
						log.Println("Configuration NOT applied")
					} else {
						log.Println("Configuration applied")
					}
				case n := <-exit:
					watcher.Remove(config)
					close(n)
					return
				}
			}
		}()
	}
	return s, nil
}
NewServer will read the supplied config file,
and return a new server.
A file watcher will be set up to monitor the
configuration file and reload settings if changes
are detected.
package server
import (
	"github.com/klauspost/shutdown"
	"gopkg.in/fsnotify.v1"
	"log"
	"net/http"
	"sync"
)
type Server struct {
	Config     Config
	mu         sync.RWMutex
	handler    *ReverseProxy
	exitMonInv chan chan struct{}  
}