github.com/ijc/docker-app@v0.6.1-0.20181012090447-c7ca8bc483fb/internal/helm/templateloader/interpolate.go (about)

     1  package templateloader
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/pkg/errors"
     7  )
     8  
     9  // should match http://yaml.org/type/bool.html
    10  func toBoolean(value string) (interface{}, error) {
    11  	switch strings.ToLower(value) {
    12  	case "y", "yes", "true", "on":
    13  		return true, nil
    14  	case "n", "no", "false", "off":
    15  		return false, nil
    16  	default:
    17  		return nil, errors.Errorf("invalid boolean: %s", value)
    18  	}
    19  }