Exemplo n.º 1
0
func Start() {
	timeStart = time.Now()
	templates = template.Must(template.ParseFiles("www/index.html"))

	cfgCtrl := srv.Cfg().Get("server")
	sessionkey := cfgCtrl.Get("sessionkey").String()

	http.Handle("/rpc/", seshcookie.NewSessionHandler(&RpcHandler{}, sessionkey, nil))
	http.Handle("/upload", seshcookie.NewSessionHandler(&UploadHandler{}, sessionkey, nil))
	//http.HandleFunc("/vfile/", vfileHandler)
	http.Handle("/", seshcookie.NewSessionHandler(&WebHandler{}, sessionkey, nil))
	StartAuth()

	port := cfgCtrl.Get("port").String()
	if len(port) > 0 {
		srv.HttpListenAndServeAsync(":"+port, nil, "", "", "")
	}
	tlsport := cfgCtrl.Get("tlsport").String()
	if len(tlsport) > 0 && tlsport != "null" {
		srv.HttpListenAndServeAsync(":"+tlsport, nil, "tls_cert.pem", "tls_key.pem", "")
	}

	//srv.VersionDataDir = cfgCtrl.Get("data").String()
	//srv.DoRefreshVersions()
}
Exemplo n.º 2
0
func StartWeb() {
	http.HandleFunc("/rpc/", rpcHandler)

	cfgCtrl := srv.Cfg().Get("server")
	port := cfgCtrl.Get("port").String()
	if len(port) > 0 {
		srv.HttpListenAndServeAsync(":"+port, nil, "", "", "")
	}
	tlsport := cfgCtrl.Get("tlsport").String()
	if len(tlsport) > 0 && tlsport != "null" {
		srv.HttpListenAndServeAsync(":"+tlsport, nil, "tls_cert.pem", "tls_key.pem", "")
	}
}