Config sets the configuration to use for the server. It must be called before Run.
(cfg string)
| 78 | // Config sets the configuration to use for the server. It must be called |
| 79 | // before Run. |
| 80 | func (t *T) Config(cfg string) { |
| 81 | t.Helper() |
| 82 | |
| 83 | t.cfg = cfg |
| 84 | |
| 85 | if t.servProc != nil { |
| 86 | t.Log("Reloading configuration for running server...") |
| 87 | |
| 88 | configPreable := "state_dir " + filepath.Join(t.testDir, "statedir") + "\n" + |
| 89 | "runtime_dir " + filepath.Join(t.testDir, "runtimedir") + "\n\n" |
| 90 | |
| 91 | err := os.WriteFile(filepath.Join(t.testDir, "maddy.conf"), []byte(configPreable+t.cfg), os.ModePerm) |
| 92 | if err != nil { |
| 93 | t.Fatal("Test configuration failed:", err) |
| 94 | } |
| 95 | |
| 96 | t.reloadConfig() |
| 97 | } |
| 98 | } |
| 99 | |
| 100 | // DNS sets the DNS zones to emulate for the tested server instance. |
| 101 | // |