Esempio n. 1
0
func ApplyConfig(from string, name string, data map[string]interface{}, resources map[string]interface{}) {

	var fileName = data["fileName"].(string)
	var jsonData = data["data"].(interface{})
	var mapData = data["data"].(map[string]interface{})

	fmt.Println("Config applied!!! ", fileName)

	client := resources["client"].(*ceb.CEBClient)
	client.UpdateCommandMetadata(fileName, mapData)
	config.Add(jsonData, fileName)

	//jsonBytes, _ := json.Marshal(jsonData)
	//jsonString := string(jsonBytes[:len(jsonBytes)])
	//config.Save(fileName, jsonString)

	/*	client := resources["client"].(*fws.FWSClient)

		agentInfo := AgentInfo{}
		agentInfo.CommandMaps = client.CommandMaps
		agentInfo.StatMetadata = client.StatMetadata
		agentInfo.ConfigMetadata = client.ConfigMetadata

		if agent.ListnerName != "" {
			agent.Client.ClientCommand(agent.ListnerName, "agent", "test", agentInfo)
		}
	*/

}
Esempio n. 2
0
func GetConfig() ServiceConfig {
	b, err := config.Get("Service")
	if err == nil {
		json.Unmarshal(b, &Config)
	} else {
		Config = ServiceConfig{}
		config.Add(Config, "Service")
	}
	return Config

}
Esempio n. 3
0
func SetConfig(c ServiceConfig) {

	config.Add(c, "Service")
}