Skip to content

Commit a8f425c

Browse files
committed
Move docker image name to global constants module
1 parent f111456 commit a8f425c

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

src/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,5 @@ const CLI_WINDOWS_PATHS = [
3333

3434
export const CLI_PATHS =
3535
platform() === "win32" ? CLI_WINDOWS_PATHS : CLI_UNIX_PATHS;
36+
37+
export const LOCALSTACK_DOCKER_IMAGE_NAME = "localstack/localstack-pro";

src/utils/cli.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ import { access } from "node:fs/promises";
44
import type { CancellationToken, LogOutputChannel } from "vscode";
55
import { workspace } from "vscode";
66

7-
import { CLI_PATHS } from "../constants.ts";
7+
import { CLI_PATHS, LOCALSTACK_DOCKER_IMAGE_NAME } from "../constants.ts";
88

99
import { exec } from "./exec.ts";
1010
import { spawn } from "./spawn.ts";
1111
import type { SpawnOptions } from "./spawn.ts";
1212

13-
const IMAGE_NAME = "localstack/localstack-pro";
13+
const IMAGE_NAME = LOCALSTACK_DOCKER_IMAGE_NAME; // not using the import directly as the constant name should match the env var
1414
const LOCALSTACK_LDM_PREVIEW = "1";
1515

1616
const findLocalStack = async (): Promise<string> => {

src/utils/setup.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
import type { CancellationToken, LogOutputChannel } from "vscode";
22
import * as z from "zod/v4-mini";
33

4+
import {LOCALSTACK_DOCKER_IMAGE_NAME} from "../constants.ts";
5+
46
import { checkIsAuthenticated } from "./authenticate.ts";
57
import { checkIsProfileConfigured } from "./configure-aws.ts";
68
import { exec } from "./exec.ts";
@@ -25,8 +27,6 @@ export async function checkSetupStatus(outputChannel: LogOutputChannel) {
2527
};
2628
}
2729

28-
const LOCALSTACK_DOCKER_IMAGE = "localstack/localstack-pro";
29-
3030
export async function updateDockerImage(
3131
outputChannel: LogOutputChannel,
3232
cancellationToken: CancellationToken,
@@ -49,7 +49,7 @@ async function getDockerImageSemverVersion(
4949
outputChannel: LogOutputChannel,
5050
): Promise<string | undefined> {
5151
try {
52-
const { stdout } = await exec(`docker inspect ${LOCALSTACK_DOCKER_IMAGE}`);
52+
const { stdout } = await exec(`docker inspect ${LOCALSTACK_DOCKER_IMAGE_NAME}`);
5353
const data: unknown = JSON.parse(stdout);
5454
const parsed = InspectSchema.safeParse(data);
5555
if (!parsed.success) {
@@ -77,7 +77,7 @@ async function pullDockerImage(
7777
cancellationToken: CancellationToken,
7878
): Promise<void> {
7979
try {
80-
await spawn("docker", ["pull", LOCALSTACK_DOCKER_IMAGE], {
80+
await spawn("docker", ["pull", LOCALSTACK_DOCKER_IMAGE_NAME], {
8181
outputChannel,
8282
outputLabel: "docker.pull",
8383
cancellationToken: cancellationToken,

0 commit comments

Comments
 (0)