// serviceSetSettingsStrings updates the settings for the given service, // taking the configuration from a map of strings. func serviceSetSettingsStrings(service *state.Service, settings map[string]string) error { ch, _, err := service.Charm() if err != nil { return err } changes, err := ch.Config().ParseSettingsStrings(settings) if err != nil { return err } return service.UpdateConfigSettings(changes) }
// serviceSetSettingsYAML updates the settings for the given service, // taking the configuration from a YAML string. func serviceSetSettingsYAML(service *state.Service, settings string) error { ch, _, err := service.Charm() if err != nil { return err } changes, err := ch.Config().ParseSettingsYAML([]byte(settings), service.Name()) if err != nil { return err } return service.UpdateConfigSettings(changes) }