Exemple #1
0
func (d *LocationDirective) Apply(c api.Server, items map[string]interface{}) (bool, error) {
	if err := api.Remarshal(items, d); err != nil {
		return false, err
	}
	if d.Location == "" {
		return false, errors.New("location directive missing path")
	}
	r := c.Route(strings.TrimSpace(d.Location))
	r = d.Match.SetRoute(r)
	r = d.SetContentHandler(c, r)
	return false, nil
}
Exemple #2
0
func (d *HttpDirective) Apply(c api.Server, items map[string]interface{}) (bool, error) {
	if err := api.Remarshal(items, d); err != nil {
		log.Error("directive.http.remarshal", "error", err)
		return false, err
	}
	host, cf, kf := d.Http, d.CertFile, d.KeyFile
	if host == "" {
		host = d.Https
	}
	// mb check cert and key files exist and are readable
	c.Endpoint(host, cf, kf, host == d.Https)
	return false, nil
}