Read reads the config file
(ctx context.DnoteCtx)
| 60 | |
| 61 | // Read reads the config file |
| 62 | func Read(ctx context.DnoteCtx) (Config, error) { |
| 63 | var ret Config |
| 64 | |
| 65 | configPath := GetPath(ctx) |
| 66 | b, err := os.ReadFile(configPath) |
| 67 | if err != nil { |
| 68 | return ret, errors.Wrap(err, "reading config file") |
| 69 | } |
| 70 | |
| 71 | err = yaml.Unmarshal(b, &ret) |
| 72 | if err != nil { |
| 73 | return ret, errors.Wrap(err, "unmarshalling config") |
| 74 | } |
| 75 | |
| 76 | return ret, nil |
| 77 | } |
| 78 | |
| 79 | // Write writes the config to the config file |
| 80 | func Write(ctx context.DnoteCtx, cf Config) error { |