Esempio n. 1
0
func main() {
	SetGEnv("release")
	var root = ARouter()
	//root.Use(auth.ABasicAuth("levy", "levythu", "This site only"))
	root.Use(auth.ABasicAuth(func(u string, p string) bool {
		if u+"00" == p {
			return true
		}
		return false
	}, "Testify"))
	root.Get(func(req Request, res Response) {
		res.Send("Greetings!")
	})

	fmt.Println("Running on port 8192...")
	root.Launch(":8192")
}
Esempio n. 2
0
func getAdminPageRouter() Router {
	var r = ARouter()

	if conf.ADMIN_USER != "" {
		r.Use(auth.ABasicAuth(conf.ADMIN_USER, conf.ADMIN_PASSWORD, ":[intranet]/admin"))
	} else {
		Secretary.Warn("intranet::getAdminPageRouter()", "Administrator authentication is canceled. Please ensure the inner service is "+
			"running on a safe network, otherwise set inner_service_admin_user in cofiguration.")
	}
	var p, err = GetABSPath("./public/intranet")
	if err != nil {
		Secretary.Error("intranet::getAdminPageRouter()", "Fail to locate public directory. Intranet service stops.")
		return nil
	}
	r.Use("/", staticfs.AStaticfs(p))
	r.Get("/tasks", getMergingTaskInfo)
	r.Get("/logs", getLoggingInfo)
	r.Get("/fdinfo", getFDInfo)
	r.Get("/gossiper", getGossipInfo)
	r.Get("/cluster", getClusterInfo)

	return r
}