github.com/jingruilea/kubeedge@v1.2.0-beta.0.0.20200410162146-4bb8902b3879/edge/pkg/devicetwin/config/config.go (about)

     1  package config
     2  
     3  import (
     4  	"sync"
     5  
     6  	"github.com/kubeedge/kubeedge/pkg/apis/componentconfig/edgecore/v1alpha1"
     7  )
     8  
     9  var Config Configure
    10  var once sync.Once
    11  
    12  type Configure struct {
    13  	v1alpha1.DeviceTwin
    14  	NodeName string
    15  }
    16  
    17  func InitConfigure(deviceTwin *v1alpha1.DeviceTwin, nodeName string) {
    18  	once.Do(func() {
    19  		Config = Configure{
    20  			DeviceTwin: *deviceTwin,
    21  			NodeName:   nodeName,
    22  		}
    23  	})
    24  }
    25  
    26  func Get() *Configure {
    27  	return &Config
    28  }