func ServerExecTimeout(timeout time.Duration) ServerOption {
	return func(h *HookServer) error {
		h.Timeout = timeout
		return nil
	}
}
ServerExecTimeout configures the HookServer per-script execution timeout
package hookah
import (
	"bytes"
	"encoding/json"
	"errors"
	"fmt"
	"io/ioutil"
	"log"
	"net/http"
	"os"
	"regexp"
	"sync"
	"time"
	multierror "github.com/hashicorp/go-multierror"
)
var errsNotDir = errors.New("Given path is not a dir")
var validGhEvent = regexp.MustCompile(`^[a-z_]{1,30}$`)
type Logger interface {
	Printf(format string, v ...interface{})
}
type HookServer struct {
	RootDir string
	Timeout  time.Duration
	ErrorLog Logger
	InfoLog  Logger
	sync.Mutex
}
type ServerOption func(*HookServer) error
func NewHookServer(rootdir string, options ...ServerOption) (*HookServer, error) {
	f, err := os.Open(rootdir)
	if err != nil {
		return nil, err
	}
	defer f.Close()
	fi, err := f.Stat()
	if err != nil {
		return nil, err
	}
	if !fi.IsDir() {
		return nil, errsNotDir
	}
	server := &HookServer{
		RootDir: rootdir,
	}
	var result *multierror.Error
	for _, option := range options {
		err := option(server)
		result = multierror.Append(result, err)
	}
	return server, result.ErrorOrNil()
}