SaveGlobalUserConfig saves the UserConfig back to disk. This is only used in integration tests, so we are a bit sloppy with error handling.
()
| 677 | // SaveGlobalUserConfig saves the UserConfig back to disk. This is only used in |
| 678 | // integration tests, so we are a bit sloppy with error handling. |
| 679 | func (c *AppConfig) SaveGlobalUserConfig() { |
| 680 | if len(c.globalUserConfigFiles) != 1 { |
| 681 | panic("expected exactly one global user config file") |
| 682 | } |
| 683 | |
| 684 | yamlContent, err := yaml.Marshal(c.userConfig) |
| 685 | if err != nil { |
| 686 | log.Fatalf("error marshalling user config: %v", err) |
| 687 | } |
| 688 | |
| 689 | err = os.WriteFile(c.globalUserConfigFiles[0].Path, yamlContent, 0o644) |
| 690 | if err != nil { |
| 691 | log.Fatalf("error saving user config: %v", err) |
| 692 | } |
| 693 | } |
| 694 | |
| 695 | // AppState stores data between runs of the app like when the last update check |
| 696 | // was performed and which other repos have been checked out |