@forge/tunnel
6.3.9-next.106.3.9-next.11
out/command/interactors/tunnel-interactor.js~
out/command/interactors/tunnel-interactor.jsModified+26−1
Index: package/out/command/interactors/tunnel-interactor.js
===================================================================
--- package/out/command/interactors/tunnel-interactor.js
+++ package/out/command/interactors/tunnel-interactor.js
@@ -9,11 +9,13 @@
const fs_1 = tslib_1.__importDefault(require("fs"));
const chokidar_1 = tslib_1.__importDefault(require("chokidar"));
class TunnelInteractor {
logger;
+ dockerAuthenticator;
statsigService;
- constructor(logger, statsigService) {
+ constructor(logger, statsigService, dockerAuthenticator) {
this.logger = logger;
+ this.dockerAuthenticator = dockerAuthenticator;
this.statsigService = statsigService;
}
logTunnelStatus(localPort, tunnelOptions) {
this.logger.info('');
@@ -86,8 +88,31 @@
const multiCompiler = new multi_compiler_watcher_1.MultiCompilerWatcher(faasServer, uiServers);
if (tunnelOptions.verify) {
await (0, bundler_1.runLinter)(this.statsigService);
}
+ if (tunnelOptions.containersDockerComposeFiles) {
+ try {
+ if (this.dockerAuthenticator) {
+ this.logger.info('');
+ this.logger.info(cli_shared_1.Text.tunnel.preBundleTask(cli_shared_1.Text.tunnel.authenticatingDocker));
+ const childProcess = await this.dockerAuthenticator.authenticateDocker();
+ await (0, cli_shared_1.processDockerAuthentication)(childProcess);
+ }
+ for (const [serviceKey, filePath] of Object.entries(tunnelOptions.containersDockerComposeFiles)) {
+ this.logger.info('');
+ this.logger.info(cli_shared_1.Text.tunnel.startingContainerService(serviceKey));
+ await (0, cli_shared_1.startDockerComposeStack)(filePath, serviceKey);
+ }
+ }
+ catch (err) {
+ this.logger.error(new Error(cli_shared_1.Text.tunnel.error.unableToStartContainerServices));
+ for (const filePath of Object.values(tunnelOptions.containersDockerComposeFiles)) {
+ await (0, cli_shared_1.deleteDockerComposeFile)(filePath);
+ }
+ throw err;
+ }
+ this.logger.info('');
+ }
this.logger.info(cli_shared_1.Text.tunnel.preBundleTask(cli_shared_1.Text.tunnel.bundlingHeader));
try {
const output = await multiCompiler.compileAndWatch({
onRuntimeChange: { onBuildWillStart, onBuildFinished: onBuildFinished('runtime') },