|
1 | 1 | import * as path from 'path'; |
2 | 2 | import * as fs from 'fs'; |
3 | 3 | import * as envPaths from 'env-paths'; |
4 | | -import { getStandalone, generateCACertificate } from 'mockttp'; |
5 | | -import { MockttpStandalone } from 'mockttp/dist/standalone/mockttp-standalone'; |
| 4 | +import { getAdminServer, generateCACertificate } from 'mockttp'; |
| 5 | +import { MockttpAdminServer } from 'mockttp'; |
6 | 6 | import { Mutex } from 'async-mutex'; |
7 | 7 |
|
8 | 8 | import updateCommand from '@oclif/plugin-update/lib/commands/update'; |
@@ -66,18 +66,18 @@ function checkCertExpiry(certContents: string): void { |
66 | 66 | } |
67 | 67 |
|
68 | 68 | function manageBackgroundServices( |
69 | | - standalone: MockttpStandalone, |
| 69 | + standalone: MockttpAdminServer, |
70 | 70 | httpsConfig: { certPath: string, certContent: string } |
71 | 71 | ) { |
72 | | - standalone.on('mock-server-started', async (server) => { |
73 | | - startDockerInterceptionServices(server.port, httpsConfig, ruleParameters) |
| 72 | + standalone.on('mock-session-started', async ({ http }) => { |
| 73 | + startDockerInterceptionServices(http.getMockServer().port, httpsConfig, ruleParameters) |
74 | 74 | .catch((error) => { |
75 | 75 | console.log("Could not start Docker components:", error); |
76 | 76 | }); |
77 | 77 | }); |
78 | 78 |
|
79 | | - standalone.on('mock-server-stopping', (server) => { |
80 | | - stopDockerInterceptionServices(server.port, ruleParameters) |
| 79 | + standalone.on('mock-session-stopping', ({ http }) => { |
| 80 | + stopDockerInterceptionServices(http.getMockServer().port, ruleParameters) |
81 | 81 | .catch((error) => { |
82 | 82 | console.log("Could not stop Docker components:", error); |
83 | 83 | }); |
@@ -112,7 +112,7 @@ export async function runHTK(options: { |
112 | 112 | console.log('Certificates setup in', certSetupTime - configCheckTime, 'ms'); |
113 | 113 |
|
114 | 114 | // Start a Mockttp standalone server |
115 | | - const standalone = getStandalone({ |
| 115 | + const standalone = getAdminServer({ |
116 | 116 | serverDefaults: { |
117 | 117 | cors: false, // Don't add mocked CORS responses to intercepted traffic |
118 | 118 | recordTraffic: false, // Don't persist traffic here (keep it in the UI) |
|
0 commit comments