初始化环境文件
This commit is contained in:
14
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js
generated
vendored
Normal file
14
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseDualstackEndpointConfigOptions.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { booleanSelector, SelectorType } from "@smithy/util-config-provider";
|
||||
export const ENV_USE_DUALSTACK_ENDPOINT = "AWS_USE_DUALSTACK_ENDPOINT";
|
||||
export const CONFIG_USE_DUALSTACK_ENDPOINT = "use_dualstack_endpoint";
|
||||
export const DEFAULT_USE_DUALSTACK_ENDPOINT = false;
|
||||
export const NODE_USE_DUALSTACK_ENDPOINT_CONFIG_OPTIONS = {
|
||||
environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV),
|
||||
configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG),
|
||||
default: false,
|
||||
};
|
||||
export const nodeDualstackConfigSelectors = {
|
||||
environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_DUALSTACK_ENDPOINT, SelectorType.ENV),
|
||||
configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_DUALSTACK_ENDPOINT, SelectorType.CONFIG),
|
||||
default: undefined,
|
||||
};
|
||||
14
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseFipsEndpointConfigOptions.js
generated
vendored
Normal file
14
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/NodeUseFipsEndpointConfigOptions.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { booleanSelector, SelectorType } from "@smithy/util-config-provider";
|
||||
export const ENV_USE_FIPS_ENDPOINT = "AWS_USE_FIPS_ENDPOINT";
|
||||
export const CONFIG_USE_FIPS_ENDPOINT = "use_fips_endpoint";
|
||||
export const DEFAULT_USE_FIPS_ENDPOINT = false;
|
||||
export const NODE_USE_FIPS_ENDPOINT_CONFIG_OPTIONS = {
|
||||
environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV),
|
||||
configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG),
|
||||
default: false,
|
||||
};
|
||||
export const nodeFipsConfigSelectors = {
|
||||
environmentVariableSelector: (env) => booleanSelector(env, ENV_USE_FIPS_ENDPOINT, SelectorType.ENV),
|
||||
configFileSelector: (profile) => booleanSelector(profile, CONFIG_USE_FIPS_ENDPOINT, SelectorType.CONFIG),
|
||||
default: undefined,
|
||||
};
|
||||
4
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/index.js
generated
vendored
Normal file
4
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/index.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
export * from "./NodeUseDualstackEndpointConfigOptions";
|
||||
export * from "./NodeUseFipsEndpointConfigOptions";
|
||||
export * from "./resolveCustomEndpointsConfig";
|
||||
export * from "./resolveEndpointsConfig";
|
||||
10
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/resolveCustomEndpointsConfig.js
generated
vendored
Normal file
10
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/resolveCustomEndpointsConfig.js
generated
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
import { normalizeProvider } from "@smithy/util-middleware";
|
||||
export const resolveCustomEndpointsConfig = (input) => {
|
||||
const { tls, endpoint, urlParser, useDualstackEndpoint } = input;
|
||||
return Object.assign(input, {
|
||||
tls: tls ?? true,
|
||||
endpoint: normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint),
|
||||
isCustomEndpoint: true,
|
||||
useDualstackEndpoint: normalizeProvider(useDualstackEndpoint ?? false),
|
||||
});
|
||||
};
|
||||
14
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/resolveEndpointsConfig.js
generated
vendored
Normal file
14
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/resolveEndpointsConfig.js
generated
vendored
Normal file
@@ -0,0 +1,14 @@
|
||||
import { normalizeProvider } from "@smithy/util-middleware";
|
||||
import { getEndpointFromRegion } from "./utils/getEndpointFromRegion";
|
||||
export const resolveEndpointsConfig = (input) => {
|
||||
const useDualstackEndpoint = normalizeProvider(input.useDualstackEndpoint ?? false);
|
||||
const { endpoint, useFipsEndpoint, urlParser, tls } = input;
|
||||
return Object.assign(input, {
|
||||
tls: tls ?? true,
|
||||
endpoint: endpoint
|
||||
? normalizeProvider(typeof endpoint === "string" ? urlParser(endpoint) : endpoint)
|
||||
: () => getEndpointFromRegion({ ...input, useDualstackEndpoint, useFipsEndpoint }),
|
||||
isCustomEndpoint: !!endpoint,
|
||||
useDualstackEndpoint,
|
||||
});
|
||||
};
|
||||
15
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/utils/getEndpointFromRegion.js
generated
vendored
Normal file
15
node_modules/@smithy/config-resolver/dist-es/endpointsConfig/utils/getEndpointFromRegion.js
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
export const getEndpointFromRegion = async (input) => {
|
||||
const { tls = true } = input;
|
||||
const region = await input.region();
|
||||
const dnsHostRegex = new RegExp(/^([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9])$/);
|
||||
if (!dnsHostRegex.test(region)) {
|
||||
throw new Error("Invalid region in client config");
|
||||
}
|
||||
const useDualstackEndpoint = await input.useDualstackEndpoint();
|
||||
const useFipsEndpoint = await input.useFipsEndpoint();
|
||||
const { hostname } = (await input.regionInfoProvider(region, { useDualstackEndpoint, useFipsEndpoint })) ?? {};
|
||||
if (!hostname) {
|
||||
throw new Error("Cannot resolve hostname from client config");
|
||||
}
|
||||
return input.urlParser(`${tls ? "https:" : "http:"}//${hostname}`);
|
||||
};
|
||||
Reference in New Issue
Block a user