github.com/yanndegat/hiera@v0.6.8/provider/scopelookupkey.go (about)

     1  package provider
     2  
     3  import (
     4  	"github.com/lyraproj/dgo/dgo"
     5  	"github.com/lyraproj/hierasdk/hiera"
     6  	"github.com/yanndegat/hiera/api"
     7  )
     8  
     9  // ScopeLookupKey is a function that performs a lookup in the current scope.
    10  func ScopeLookupKey(pc hiera.ProviderContext, key string) dgo.Value {
    11  	sc, ok := pc.(api.ServerContext)
    12  	if !ok {
    13  		return nil
    14  	}
    15  	return sc.Invocation().Scope().Get(key)
    16  }