Skip to content

Commit

Permalink
Expose settings from storageHelper
Browse files Browse the repository at this point in the history
  • Loading branch information
bb4L committed Jul 4, 2021
1 parent d4e3fca commit 365ed70
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions storage/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,22 @@ func (storageHelper *Helper) getStoredData() (RpiRadioAlarmData, error) {
return data, err
}

// GetSettings returns the setings stored in the file
func (storageHelper *Helper) GetSettings() (Settings, error) {
fileData, err := ioutil.ReadFile(dataFilename)
if err != nil {
panic(err)
}

var data RpiRadioAlarmData
source := []byte(fileData)
err = yaml.Unmarshal(source, &data)
if err != nil {
logger.Fatalf("error: %v", err)
}
return data.Settings, err
}

// SaveStoredData save the data to storage and releases the lock
func (storageHelper *Helper) SaveStoredData(data RpiRadioAlarmData) {
outSource, err := yaml.Marshal(data)
Expand Down

0 comments on commit 365ed70

Please sign in to comment.