@forge/cli
12.11.012.12.0-next.9
out/command-line/controller/tunnel-controller.jsout/command-line/controller/tunnel-controller.js+14−5
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
@@ -2,8 +2,9 @@
Object.defineProperty(exports, "__esModule", { value: true });
exports.TunnelController = void 0;
const cli_shared_1 = require("@forge/cli-shared");
const tunnel_service_1 = require("../../service/tunnel-service");
+const graphql_client_1 = require("../../environment/graphql-client");
class TunnelController {
nodeTunnelService;
tunnelView;
configFile;
@@ -26,14 +27,22 @@
const serviceWithTunnelConfigExists = services?.some((service) => service.containers?.some((container) => {
return !!container.tunnel;
}));
if (services && serviceWithTunnelConfigExists) {
- const appEnvironments = await this.environmentClient.listEnvironment({ appId });
- const environmentDetails = appEnvironments.filter((environment) => environment.key === envKey);
- if (environmentDetails.length < 1) {
- throw new tunnel_service_1.EnvironmentIsNotDefined(envKey);
+ let envId;
+ try {
+ const env = await this.environmentClient.getEnvironmentByKey({
+ appId,
+ environmentKey: envKey
+ });
+ envId = env.id;
}
- const envId = environmentDetails[0].id;
+ catch (err) {
+ if (err instanceof graphql_client_1.EnvironmentNotFoundError) {
+ throw new tunnel_service_1.EnvironmentIsNotDefined(envKey);
+ }
+ throw err;
+ }
const childProcess = await this.containerCommandService.authenticateDocker();
await this.processDockerAuthentication(childProcess);
const dockerComposeFilePaths = await (0, cli_shared_1.generateContainersDockerComposeFile)(services, appId, envId);
options.containersDockerComposeFiles = dockerComposeFilePaths;