Write writes the config to the config file
(ctx context.DnoteCtx, cf Config)
| 78 | |
| 79 | // Write writes the config to the config file |
| 80 | func Write(ctx context.DnoteCtx, cf Config) error { |
| 81 | path := GetPath(ctx) |
| 82 | |
| 83 | b, err := yaml.Marshal(cf) |
| 84 | if err != nil { |
| 85 | return errors.Wrap(err, "marshalling config into YAML") |
| 86 | } |
| 87 | |
| 88 | err = os.WriteFile(path, b, 0644) |
| 89 | if err != nil { |
| 90 | return errors.Wrap(err, "writing the config file") |
| 91 | } |
| 92 | |
| 93 | return nil |
| 94 | } |
no test coverage detected