github.com/hairyhenderson/templater@v3.5.0+incompatible/data/datasource_env.go (about)

     1  package data
     2  
     3  import (
     4  	"strings"
     5  
     6  	"github.com/hairyhenderson/gomplate/env"
     7  )
     8  
     9  func readEnv(source *Source, args ...string) (b []byte, err error) {
    10  	n := source.URL.Path
    11  	n = strings.TrimPrefix(n, "/")
    12  	if n != "" {
    13  	} else if n == "" {
    14  		n = source.URL.Opaque
    15  	}
    16  
    17  	b = []byte(env.Getenv(n))
    18  	return b, nil
    19  }