npm package diff
Package: @forge/cli
Versions: 10.4.1 - 10.5.0-next.1-experimental-264fa0f
File: package/out/service/tunnel-service.js
Index: package/out/service/tunnel-service.js
===================================================================
--- package/out/service/tunnel-service.js
+++ package/out/service/tunnel-service.js
@@ -11,9 +11,8 @@
const cli_shared_1 = require("@forge/cli-shared");
const version_info_1 = require("../command-line/version-info");
const DISABLE_TTY = process.env.DISABLE_TTY === 'true';
exports.CONTAINER_NAME = `forge-tunnel-docker-${process.pid}`;
-const PATH_DOCKER_NGROK_CONFIG = '/opt/provided-ngrok-config.yml';
const cliDetails = (0, version_info_1.getCLIDetails)();
let versionTags;
if (cliDetails?.version !== undefined) {
if (process.env.FORGE_IN_LOCAL_E2E === 'true') {
@@ -45,43 +44,30 @@
cachedConfigService;
constructor(cachedConfigService) {
this.cachedConfigService = cachedConfigService;
}
- ngrokConfigPath() {
- const path = this.cachedConfigService.getNgrokConfigPath();
- if (!path) {
- throw new cli_shared_1.UserError(cli_shared_1.Text.tunnel.error.noNgrokConfig);
- }
- return path;
- }
}
class InProcessTunnelService extends TunnelServiceBase {
ui;
startTunnelCommand;
tunnelInteractor;
configFilePortFindingService;
analyticsService;
- featureFlagService;
- constructor(ui, startTunnelCommand, tunnelInteractor, configFilePortFindingService, cachedConfigService, analyticsService, featureFlagService) {
+ constructor(ui, startTunnelCommand, tunnelInteractor, configFilePortFindingService, cachedConfigService, analyticsService) {
super(cachedConfigService);
this.ui = ui;
this.startTunnelCommand = startTunnelCommand;
this.tunnelInteractor = tunnelInteractor;
this.configFilePortFindingService = configFilePortFindingService;
this.analyticsService = analyticsService;
- this.featureFlagService = featureFlagService;
}
async run(tunnelOptions, creds, debugEnabled, onError) {
try {
const resourcePortMap = await this.configFilePortFindingService.findPorts();
- const ngrokConfig = (await this.featureFlagService.isCloudflareTunnelEnabled())
- ? undefined
- : this.ngrokConfigPath();
const tunnel = await this.startTunnelCommand.execute({
environmentKey: tunnelOptions.environment || process.env.ENVIRONMENT_KEY || 'default',
resourcePortMap,
- host: 'localhost',
- ngrokConfig
+ host: 'localhost'
});
const monitor = await this.tunnelInteractor.watchApp(tunnel, tunnelOptions);
const manifestFileWatcher = this.tunnelInteractor.watchAndWarnOnManifestChanges(manifest_1.MANIFEST_FILE);
await this.tunnelInteractor.handleUserExitEvent(tunnel.stopFunction, monitor, manifestFileWatcher);
@@ -100,20 +86,15 @@
exports.InProcessTunnelService = InProcessTunnelService;
class SandboxTunnelServiceBase extends TunnelServiceBase {
configFilePortFindingService;
cachedConfigService;
- featureFlagService;
- constructor(configFilePortFindingService, cachedConfigService, featureFlagService) {
+ constructor(configFilePortFindingService, cachedConfigService) {
super(cachedConfigService);
this.configFilePortFindingService = configFilePortFindingService;
this.cachedConfigService = cachedConfigService;
- this.featureFlagService = featureFlagService;
}
async getTunnelProcessEnvironment(tunnelOptions, debugEnabled, { email, token }, port, cspReporterPort, resourcePorts) {
const graphqlGateway = (0, cli_shared_1.getGraphqlGateway)();
- const ngrokConfig = (await this.featureFlagService.isCloudflareTunnelEnabled())
- ? []
- : this.getNgrokConfigEnvironment();
return [
{ key: 'APP_FOLDER', value: '/app' },
{ key: 'FORGE_EMAIL', value: email },
{ key: 'FORGE_API_TOKEN', value: token },
@@ -124,18 +105,14 @@
{ key: 'CLI_DETAILS', value: JSON.stringify(cliDetails) },
...this.getInspectorPortEnvironment(port),
...this.getCspReporterPortEnvironment(cspReporterPort),
...this.getResourcePortEnvironment(resourcePorts),
- ...this.getUserEnvironmentVariables(),
- ...ngrokConfig
+ ...this.getUserEnvironmentVariables()
];
}
getInspectorPortEnvironment(port) {
return [{ key: 'TUNNEL_INSPECTOR_PORT', value: port.toString() }];
}
- getNgrokConfigEnvironment() {
- return [{ key: 'NGROK_CONFIG', value: this.ngrokConfigPath() }];
- }
getCspReporterPortEnvironment(cspReporterPort) {
if (cspReporterPort) {
return [{ key: 'CSP_REPORTER_PORT', value: cspReporterPort.toString() }];
}
@@ -182,14 +159,12 @@
exports.LocalTunnelService = LocalTunnelService;
class DockerTunnelService extends SandboxTunnelServiceBase {
dockerService;
analyticsService;
- featureFlagService;
- constructor(configFilePortFindingService, cachedConfigService, dockerService, analyticsService, featureFlagService) {
- super(configFilePortFindingService, cachedConfigService, featureFlagService);
+ constructor(configFilePortFindingService, cachedConfigService, dockerService, analyticsService) {
+ super(configFilePortFindingService, cachedConfigService);
this.dockerService = dockerService;
this.analyticsService = analyticsService;
- this.featureFlagService = featureFlagService;
}
async run(tunnelOptions, creds, debugEnabled) {
await this.validateDockerVersion(creds, debugEnabled);
const startPort = 8000 + Math.round(Math.random() * 100);
@@ -264,25 +239,18 @@
const options = [`-v=${process.cwd()}:/app:cached`];
if (process.env.FORGE_DEV_DOCKER_TUNNEL) {
const monorepoRoot = (0, path_1.join)(__dirname, '../../../..');
options.push(`-v=${monorepoRoot}:/monorepo:cached`);
- options.push(`-v=${monorepoRoot}/node_modules/ngrok/docker-bin:/monorepo/node_modules/ngrok/bin`);
options.push(`-v=${monorepoRoot}/node_modules/cloudflared/docker-bin:/monorepo/node_modules/cloudflared/bin`);
}
if (process.env.FORGE_TUNNEL_MOUNT_DIRECTORIES) {
const mounts = process.env.FORGE_TUNNEL_MOUNT_DIRECTORIES.split(',');
mounts.forEach((mount) => {
options.push(`-v=${mount}:cached`);
});
}
- if (!(await this.featureFlagService.isCloudflareTunnelEnabled())) {
- options.push('--mount', `type=bind,source=${this.ngrokConfigPath()},target=${PATH_DOCKER_NGROK_CONFIG}`);
- }
return options;
}
- getNgrokConfigEnvironment() {
- return [{ key: 'NGROK_CONFIG', value: PATH_DOCKER_NGROK_CONFIG }];
- }
async getCommonOptions() {
return ['--rm', `--name`, exports.CONTAINER_NAME, '--platform', 'linux/amd64'];
}
}