Skip to content

Commit 5748d92

Browse files
authored
Greengrass china endpoint (#200)
* Temporary fix for connection with greengras china endpoint * replace '-' with '.' * initial shadow example commit * try to fix input * allow user to pass in unique endpoints for greengrass * remove shadow example from endpoint branch * update region comment
1 parent d6aa508 commit 5748d92

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

lib/greengrass/discoveryclient.ts

+11-3
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,23 @@ export class DiscoveryClient {
3838
* @param bootstrap The `ClientBootstrap` to use to make an HTTP connection to the Greengrass service
3939
* @param socket_options `SocketOptions` for HTTP connection to the Greengrass service
4040
* @param tls_ctx TLS Options for the HTTP connection to Greengrass service
41-
* @param region Region to send Greengrass discovery requests to
41+
* @param region Region to send Greengrass discovery requests to (ignored if gg_server_name is set)
42+
* @param gg_server_name Optional name of greengrass endpoint
4243
*/
4344
constructor(
4445
readonly bootstrap: io.ClientBootstrap,
4546
private socket_options: io.SocketOptions,
4647
private tls_ctx: io.ClientTlsContext,
47-
readonly region: string
48+
readonly region: string,
49+
readonly gg_server_name: string = ""
4850
) {
49-
this.endpoint = `greengrass-ats.iot.${region}.amazonaws.com`;
51+
//allow user to use special endpoints
52+
if (this.gg_server_name !== "") {
53+
this.endpoint = this.gg_server_name;
54+
} else {
55+
this.endpoint = `greengrass-ats.iot.${region}.amazonaws.com`;
56+
}
57+
5058
this.connection_manager = new http.HttpClientConnectionManager(
5159
this.bootstrap,
5260
this.endpoint,

0 commit comments

Comments
 (0)