diff --git a/src/client.ts b/src/client.ts index 8749993..2bfcccb 100644 --- a/src/client.ts +++ b/src/client.ts @@ -29,8 +29,8 @@ export class OneCLI { /** * Fetch the raw container configuration from OneCLI. */ - getContainerConfig = (): Promise => { - return this.containerClient.getContainerConfig(); + getContainerConfig = (agent?: string): Promise => { + return this.containerClient.getContainerConfig(agent); }; /** diff --git a/src/container/index.ts b/src/container/index.ts index 80a6aa0..55e26a8 100644 --- a/src/container/index.ts +++ b/src/container/index.ts @@ -16,8 +16,10 @@ export class ContainerClient { /** * Fetch the raw container configuration from OneCLI. */ - getContainerConfig = async (): Promise => { - const url = `${this.baseUrl}/api/container-config`; + getContainerConfig = async (agent?: string): Promise => { + const url = agent + ? `${this.baseUrl}/api/container-config?agent=${encodeURIComponent(agent)}` + : `${this.baseUrl}/api/container-config`; try { const headers: Record = {}; @@ -60,11 +62,12 @@ export class ContainerClient { args: string[], options?: ApplyContainerConfigOptions, ): Promise => { - const { combineCaBundle = true, addHostMapping = true } = options ?? {}; + const { combineCaBundle = true, addHostMapping = true, agent } = + options ?? {}; let config: ContainerConfig; try { - config = await this.getContainerConfig(); + config = await this.getContainerConfig(agent); } catch { return false; } diff --git a/src/container/types.ts b/src/container/types.ts index f5fc5b0..d020ead 100644 --- a/src/container/types.ts +++ b/src/container/types.ts @@ -18,4 +18,9 @@ export interface ApplyContainerConfigOptions { * @default true */ addHostMapping?: boolean; + + /** + * Agent identifier to fetch config for. Uses the default agent if omitted. + */ + agent?: string; }