updateConfigAPIEndpoint updates the config file with the given API endpoint
(t *testing.T, tmpDir string, apiEndpoint string)
| 122 | |
| 123 | // updateConfigAPIEndpoint updates the config file with the given API endpoint |
| 124 | func updateConfigAPIEndpoint(t *testing.T, tmpDir string, apiEndpoint string) { |
| 125 | dnoteDir := filepath.Join(tmpDir, consts.DnoteDirName) |
| 126 | configPath := filepath.Join(dnoteDir, consts.ConfigFilename) |
| 127 | configContent := fmt.Sprintf("apiEndpoint: %s\n", apiEndpoint) |
| 128 | if err := os.WriteFile(configPath, []byte(configContent), 0644); err != nil { |
| 129 | t.Fatal(errors.Wrap(err, "writing config file")) |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | // switchToEmptyServer closes the current server and creates a new empty server, |
| 134 | // updating the config file to point to it. |
no outgoing calls