UNPKG

@softchef/cdk-iot-device-management

Version:

IoT device management is composed of things, thing types, thing groups, jobs, files API services. The constructs can be used independently, that are based on full-managed service to create an API Gateway & Lambda function.

28 lines (27 loc) 1.2 kB
var ENV_ENDPOINT_DISCOVERY = ["AWS_ENABLE_ENDPOINT_DISCOVERY", "AWS_ENDPOINT_DISCOVERY_ENABLED"]; var CONFIG_ENDPOINT_DISCOVERY = "endpoint_discovery_enabled"; var isFalsy = function (value) { return ["false", "0"].indexOf(value) >= 0; }; export var NODE_ENDPOINT_DISCOVERY_CONFIG_OPTIONS = { environmentVariableSelector: function (env) { for (var i = 0; i < ENV_ENDPOINT_DISCOVERY.length; i++) { var envKey = ENV_ENDPOINT_DISCOVERY[i]; if (envKey in env) { var value = env[envKey]; if (value === "") { throw Error("Environment variable " + envKey + " can't be empty of undefined, got \"" + value + "\""); } return !isFalsy(value); } } }, configFileSelector: function (profile) { if (CONFIG_ENDPOINT_DISCOVERY in profile) { var value = profile[CONFIG_ENDPOINT_DISCOVERY]; if (value === undefined) { throw Error("Shared config entry " + CONFIG_ENDPOINT_DISCOVERY + " can't be undefined, got \"" + value + "\""); } return !isFalsy(value); } }, default: undefined, };