Beispiel #1
0
func LoadServiceConfig(serviceId string, cfg apis.BinaryMarshaller) error {
	db := db.DatabaseInstance()
	data := db.GetData(cfgKey(serviceId))
	if len(data) == 0 {
		return mpqerr.NotFoundRequest("No service settings found: " + serviceId)
	}

	if err := cfg.Unmarshal(data); err != nil {
		log.Error("Error in '%s' service settings: %s", serviceId, err.Error())
		return mpqerr.ServerError("Service settings error: " + serviceId)
	}
	return nil
}
Beispiel #2
0
// GetServiceDescriptions Loads all service descriptions prefixed with ServiceDescPrefix
func GetServiceDescription(serviceId string) *ServiceDescription {
	db := db.DatabaseInstance()
	data := db.GetData(descKey(serviceId))
	desc, _ := UnmarshalServiceDesc([]byte(data))
	return desc
}