Ejemplo n.º 1
0
func NewServer(
	ctx scope.Context, backend proto.Backend, cluster cluster.Cluster, kms security.KMS,
	id, era, staticPath string) (*Server, error) {

	mime.AddExtensionType(".map", "application/json")

	cookieSecret, err := cluster.GetSecret(kms, "cookie", cookieKeySize)
	if err != nil {
		return nil, fmt.Errorf("error coordinating shared cookie secret: %s", err)
	}

	s := &Server{
		ID:         id,
		Era:        era,
		b:          backend,
		kms:        kms,
		staticPath: staticPath,
		sc:         securecookie.New(cookieSecret, nil),
		rootCtx:    ctx,
	}
	s.route()
	return s, nil
}