@forge/cli

14.1.0-next.1-experimental-13c2f8d14.1.0-next.21-experimental-554d417
out/command-line/controller/tunnel-controller.js
~out/command-line/controller/tunnel-controller.jsModified
+25−49
Index: package/out/command-line/controller/tunnel-controller.js
===================================================================
--- package/out/command-line/controller/tunnel-controller.js
+++ package/out/command-line/controller/tunnel-controller.js
@@ -18,74 +18,50 @@
     configFile;
     cachedConfigService;
     environmentClient;
     devSpaceService;
-    localStorageController;
-    constructor(nodeTunnelService, tunnelView, configFile, cachedConfigService, environmentClient, devSpaceService, localStorageController) {
+    constructor(nodeTunnelService, tunnelView, configFile, cachedConfigService, environmentClient, devSpaceService) {
         this.nodeTunnelService = nodeTunnelService;
         this.tunnelView = tunnelView;
         this.configFile = configFile;
         this.cachedConfigService = cachedConfigService;
         this.environmentClient = environmentClient;
         this.devSpaceService = devSpaceService;
-        this.localStorageController = localStorageController;
     }
     async run(tunnelOptions) {
         const options = await this.validateTunnelCommandOptions(tunnelOptions);
         const envKey = tunnelOptions.environment || cli_shared_1.DEFAULT_ENVIRONMENT_OPTION;
         this.tunnelView.preamble(envKey);
-        let localStorageCleanup;
-        try {
-            if (tunnelOptions.localStorage && !this.localStorageController) {
-                throw new cli_shared_1.UserError('Local storage is unavailable in this Forge CLI installation.');
+        const { app: { id: appId }, services, modules } = await this.configFile.readConfig();
+        await this.devSpaceService.displayEnforcementWarningsIfNeeded(this.tunnelView.getLogger(), appId, 'tunnel');
+        const serviceWithTunnelConfigExists = services?.some((service) => service.containers?.some((container) => {
+            return !!container.tunnel;
+        }));
+        if (services && serviceWithTunnelConfigExists) {
+            let envId;
+            try {
+                const env = await this.environmentClient.getEnvironmentByKey({
+                    appId,
+                    environmentKey: envKey
+                });
+                envId = env.id;
             }
-            if (tunnelOptions.localStorage) {
-                const localStorageController = this.localStorageController;
-                await localStorageController.startForTunnel();
-                let cleanupPromise;
-                localStorageCleanup = () => (cleanupPromise ??= localStorageController.stopForTunnel());
-                options.localStorageCleanup = localStorageCleanup;
-            }
-            const { app: { id: appId }, services, modules } = await this.configFile.readConfig();
-            await this.devSpaceService.displayEnforcementWarningsIfNeeded(this.tunnelView.getLogger(), appId, 'tunnel');
-            const serviceWithTunnelConfigExists = services?.some((service) => service.containers?.some((container) => {
-                return !!container.tunnel;
-            }));
-            if (services && serviceWithTunnelConfigExists) {
-                let envId;
-                try {
-                    const env = await this.environmentClient.getEnvironmentByKey({
-                        appId,
-                        environmentKey: envKey
-                    });
-                    envId = env.id;
+            catch (err) {
+                if (err instanceof graphql_client_1.EnvironmentNotFoundError) {
+                    throw new tunnel_service_1.EnvironmentIsNotDefined(envKey);
                 }
-                catch (err) {
-                    if (err instanceof graphql_client_1.EnvironmentNotFoundError) {
-                        throw new tunnel_service_1.EnvironmentIsNotDefined(envKey);
-                    }
-                    throw err;
-                }
-                const dockerComposeFilePaths = await (0, cli_shared_1.generateContainersDockerComposeFile)(services, appId, envId);
-                options.containersDockerComposeFiles = dockerComposeFilePaths;
+                throw err;
             }
-            if (modules) {
-                const uiKit1Modules = (0, cli_shared_1.findUIKit1Modules)(modules);
-                if (uiKit1Modules.length > 0) {
-                    this.tunnelView.displayUIKit1DeprecationMessage(uiKit1Modules);
-                }
-            }
-            return await this.nodeTunnelService.run(options);
+            const dockerComposeFilePaths = await (0, cli_shared_1.generateContainersDockerComposeFile)(services, appId, envId);
+            options.containersDockerComposeFiles = dockerComposeFilePaths;
         }
-        catch (error) {
-            if (localStorageCleanup) {
-                try {
-                    await localStorageCleanup();
-                }
-                catch { }
+        if (modules) {
+            const uiKit1Modules = (0, cli_shared_1.findUIKit1Modules)(modules);
+            if (uiKit1Modules.length > 0) {
+                this.tunnelView.displayUIKit1DeprecationMessage(uiKit1Modules);
             }
-            throw error;
         }
+        return await this.nodeTunnelService.run(options);
     }
     async validateTunnelCommandOptions(tunnelOptions) {
         const assistantName = this.cachedConfigService.getAssistantName();
         const options = {