Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ export class OneCLI {
/**
* Fetch the raw container configuration from OneCLI.
*/
getContainerConfig = (): Promise<ContainerConfig> => {
return this.containerClient.getContainerConfig();
getContainerConfig = (agent?: string): Promise<ContainerConfig> => {
return this.containerClient.getContainerConfig(agent);
};

/**
Expand Down
11 changes: 7 additions & 4 deletions src/container/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ export class ContainerClient {
/**
* Fetch the raw container configuration from OneCLI.
*/
getContainerConfig = async (): Promise<ContainerConfig> => {
const url = `${this.baseUrl}/api/container-config`;
getContainerConfig = async (agent?: string): Promise<ContainerConfig> => {
const url = agent
? `${this.baseUrl}/api/container-config?agent=${encodeURIComponent(agent)}`
: `${this.baseUrl}/api/container-config`;

try {
const headers: Record<string, string> = {};
Expand Down Expand Up @@ -60,11 +62,12 @@ export class ContainerClient {
args: string[],
options?: ApplyContainerConfigOptions,
): Promise<boolean> => {
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;
}
Expand Down
5 changes: 5 additions & 0 deletions src/container/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Loading