Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(clients): override endpoint in runtimeConfig #5312

Closed
wants to merge 1 commit into from

Conversation

trivikr
Copy link
Member

@trivikr trivikr commented Oct 4, 2023

Issue

Internal JS-4281

Description

Overrides endpoint in runtimeConfig to populate endpoint from environment variables or shared configuration

Testing

Test code:

import { ClientName } from "../aws-sdk-js-v3/clients/client-clientName/dist-cjs/index.js";

const urlToString = ({ hostname, protocol }) =>
  new URL(`${protocol}//${hostname}`).toString();

const client = new ClientName();
const endpoint = await client.config.endpoint();
console.log(urlToString(endpoint));

Configuration:

[profile config]
endpoint_url = http://config.custom.endpoint

[profile config-services]
services = config
endpoint_url = http://service.config.custom.endpoint
dynamodb =
    endpoint_url = http://invalid.dynamodb.config.custom.endpoint
elastic_beanstalk =
    endpoint_url = http://invalid.elastic_beanstalk.config.custom.endpoint

[services config]
endpoint_url = http://invalid.config.custom.endpoint
dynamodb =
    endpoint_url = http://dynamodb.config.custom.endpoint
elastic_beanstalk =
    endpoint_url = http://elastic_beanstalk.config.custom.endpoint

DynamoDB

The highest preference if one provided during client creation

Client configuration

Code:

const client = new DynamoDB({ endpoint: "http://custom.endpoint" });

Output:

http://custom.endpoint

Elastic Beanstalk


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@trivikr trivikr force-pushed the runtime-config-endpoint branch 6 times, most recently from 43a2624 to 96735aa Compare October 6, 2023 21:15
@trivikr trivikr force-pushed the runtime-config-endpoint branch from 96735aa to 74c7e3d Compare October 9, 2023 14:48
@trivikr
Copy link
Member Author

trivikr commented Oct 10, 2023

Implemented in @smithy/middleware-endpoint in smithy-lang/smithy-typescript#1014

@trivikr trivikr closed this Oct 10, 2023
@trivikr trivikr deleted the runtime-config-endpoint branch October 10, 2023 17:27
@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant