private static Services.Storage.Config GetStorageConfig(IConfigData configData, string prefix) { var defaults = new Services.Storage.Config(); var storageType = configData.GetEnum(prefix + STORAGE_TYPE_KEY, Services.Storage.Type.Unknown); switch (storageType) { case Services.Storage.Type.CosmosDbSql: return(new Services.Storage.Config { StorageType = storageType, MaxPendingOperations = configData.GetInt(prefix + STORAGE_MAX_PENDING_OPERATIONS, defaults.MaxPendingOperations), CosmosDbSqlConnString = configData.GetString(prefix + COSMOSDBSQL_CONNECTION_STRING_KEY, ""), CosmosDbSqlDatabase = configData.GetString(prefix + COSMOSDBSQL_DATABASE_KEY, ""), CosmosDbSqlCollection = configData.GetString(prefix + COSMOSDBSQL_COLLECTION_KEY, ""), CosmosDbSqlThroughput = configData.GetInt(prefix + COSMOSDBSQL_THROUGHPUT_KEY, defaults.CosmosDbSqlThroughput), }); case Services.Storage.Type.TableStorage: return(new Services.Storage.Config { StorageType = storageType, MaxPendingOperations = configData.GetInt(prefix + STORAGE_MAX_PENDING_OPERATIONS, defaults.MaxPendingOperations), TableStorageConnString = configData.GetString(prefix + TABLESTORAGE_CONNECTION_STRING_KEY, ""), TableStorageTableName = configData.GetString(prefix + TABLESTORAGE_TABLE_KEY, "") }); } throw new ArgumentOutOfRangeException("Unknown storage type: " + storageType); }
public Config(IConfigData configData) { this.Port = configData.GetInt(PORT_KEY); var storageType = configData.GetString(STORAGE_TYPE_KEY).ToLowerInvariant(); var documentDbConnString = configData.GetString(DOCUMENT_DB_CONNECTION_STRING_KEY); if (storageType == "documentdb" && (string.IsNullOrEmpty(documentDbConnString) || documentDbConnString.StartsWith("${") || documentDbConnString.Contains("..."))) { // In order to connect to the storage, the service requires a connection // string for Document Db. The value can be found in the Azure Portal. // The connection string can be stored in the 'appsettings.ini' configuration // file, or in the PCS_STORAGEADAPTER_DOCUMENTDB_CONNSTRING environment variable. // When working with VisualStudio, the environment variable can be set in the // WebService project settings, under the "Debug" tab. throw new Exception("The service configuration is incomplete. " + "Please provide your DocumentDb connection string. " + "For more information, see the environment variables " + "used in project properties and the 'documentdb_connstring' " + "value in the 'appsettings.ini' configuration file."); } this.ServicesConfig = new ServicesConfig { StorageType = storageType, DocumentDbConnString = documentDbConnString, DocumentDbDatabase = configData.GetString(DOCUMENT_DB_DATABASE_KEY), DocumentDbCollection = configData.GetString(DOCUMENT_DB_COLLECTION_KEY), DocumentDbRUs = configData.GetInt(DOCUMENT_DB_RUS_KEY), }; }
private static ILoggingConfig GetLogConfig(IConfigData configData) { var data = configData.GetString(LOGGING_BLACKLIST_SOURCES_KEY); var values = data.Replace(";", ",").Split(","); var blacklist = new HashSet <string>(); foreach (var k in values) { blacklist.Add(k); } data = configData.GetString(LOGGING_WHITELIST_SOURCES_KEY); values = data.Replace(";", ",").Split(","); var whitelist = new HashSet <string>(); foreach (var k in values) { whitelist.Add(k); } Enum.TryParse(configData.GetString(LOGGING_LOGLEVEL_KEY, Services.Diagnostics.LoggingConfig.DEFAULT_LOGLEVEL.ToString()), true, out LogLevel logLevel); var result = new LoggingConfig { LogLevel = logLevel, BlackList = blacklist, WhiteList = whitelist, DateFormat = configData.GetString(LOGGING_DATEFORMAT_KEY, Services.Diagnostics.LoggingConfig.DEFAULT_DATE_FORMAT), LogProcessId = configData.GetBool(LOGGING_INCLUDEPROCESSID_KEY, true), ExtraDiagnostics = configData.GetBool(LOGGING_EXTRADIAGNOSTICS_KEY, false), ExtraDiagnosticsPath = configData.GetString(LOGGING_EXTRADIAGNOSTICSPATH_KEY) }; return(result); }
public Config(IConfigData configData) { this.Port = configData.GetInt(PORT_KEY); this.ServicesConfig = new ServicesConfig { JwtUserIdFrom = configData.GetString(JWT_USER_ID_FROM_KEY, "oid").Split(','), JwtNameFrom = configData.GetString(JWT_NAME_FROM_KEY, "given_name,family_name").Split(','), JwtEmailFrom = configData.GetString(JWT_EMAIL_FROM_KEY, "email").Split(','), JwtRolesFrom = configData.GetString(JWT_ROLES_FROM_KEY, "roles"), PoliciesFolder = MapRelativePath(configData.GetString(POLICIES_FOLDER_KEY)) }; this.ClientAuthConfig = new ClientAuthConfig { // By default CORS is disabled CorsWhitelist = configData.GetString(CORS_WHITELIST_KEY, string.Empty), // By default Auth is required AuthRequired = configData.GetBool(AUTH_REQUIRED_KEY, true), // By default auth type is JWT AuthType = configData.GetString(AUTH_TYPE_KEY, "JWT"), // By default the only trusted algorithms are RS256, RS384, RS512 JwtAllowedAlgos = configData.GetString(JWT_ALGOS_KEY, "RS256,RS384,RS512").Split(','), JwtIssuer = configData.GetString(JWT_ISSUER_KEY, String.Empty), JwtAudience = configData.GetString(JWT_AUDIENCE_KEY, String.Empty), // By default the allowed clock skew is 2 minutes JwtClockSkew = TimeSpan.FromSeconds(configData.GetInt(JWT_CLOCK_SKEW_KEY, 120)), }; }
public Config(IConfigData configData) { this.Port = configData.GetInt(PORT_KEY); this.ServicesConfig = new ServicesConfig { StorageAdapterApiUrl = configData.GetString(STORAGE_ADAPTER_URL_KEY), DeviceSimulationApiUrl = configData.GetString(DEVICE_SIMULATION_URL_KEY), TelemetryApiUrl = configData.GetString(TELEMETRY_URL_KEY), SeedTemplate = configData.GetString(SEED_TEMPLATE_KEY), AzureMapsKey = configData.GetString(AZURE_MAPS_KEY) }; this.ClientAuthConfig = new ClientAuthConfig { // By default CORS is disabled CorsWhitelist = configData.GetString(CORS_WHITELIST_KEY, string.Empty), // By default Auth is required AuthRequired = configData.GetBool(AUTH_REQUIRED_KEY, true), // By default auth type is JWT AuthType = configData.GetString(AUTH_TYPE_KEY, "JWT"), // By default the only trusted algorithms are RS256, RS384, RS512 JwtAllowedAlgos = configData.GetString(JWT_ALGOS_KEY, "RS256,RS384,RS512").Split(','), JwtIssuer = configData.GetString(JWT_ISSUER_KEY), JwtAudience = configData.GetString(JWT_AUDIENCE_KEY), // By default the allowed clock skew is 2 minutes JwtClockSkew = TimeSpan.FromSeconds(configData.GetInt(JWT_CLOCK_SKEW_KEY, 120)), }; }
private static IServicesConfig GetServicesConfig(IConfigData configData) { var connstring = configData.GetString(IOTHUB_CONNSTRING_KEY); if (connstring.ToLowerInvariant().Contains("azure iot hub")) { // In order to connect to Azure IoT Hub, the service requires a connection // string. The value can be found in the Azure Portal. For more information see // https://docs.microsoft.com/azure/iot-hub/iot-hub-csharp-csharp-getstarted // to find the connection string value. // The connection string can be stored in the 'appsettings.ini' configuration // file, or in the PCS_IOTHUB_CONNSTRING environment variable. When // working with VisualStudio, the environment variable can be set in the // WebService project settings, under the "Debug" tab. throw new Exception("The service configuration is incomplete. " + "Please provide your Azure IoT Hub connection string. " + "For more information, see the environment variables " + "used in project properties and the 'iothub_connstring' " + "value in the 'appsettings.ini' configuration file."); } return(new ServicesConfig { DeviceModelsFolder = MapRelativePath(configData.GetString(DEVICE_MODELS_FOLDER_KEY)), DeviceModelsScriptsFolder = MapRelativePath(configData.GetString(DEVICE_MODELS_SCRIPTS_FOLDER_KEY)), IoTHubDataFolder = MapRelativePath(configData.GetString(IOTHUB_DATA_FOLDER_KEY)), IoTHubConnString = connstring, StorageAdapterApiUrl = configData.GetString(STORAGE_ADAPTER_API_URL_KEY), StorageAdapterApiTimeout = configData.GetInt(STORAGE_ADAPTER_API_TIMEOUT_KEY), TwinReadWriteEnabled = configData.GetBool(TWIN_READ_WRITE_ENABLED_KEY, true) }); }
/// <summary>Detect the table type. The allowed values are defined by AsaOutputStorageType enum</summary> private static AsaOutputStorageType GetStorageType(IConfigData configData, string tableName) { AsaOutputStorageType result; switch (tableName) { case MESSAGES: if (!Enum.TryParse(configData.GetString(MESSAGES_STORAGE_TYPE_KEY), true, out result)) { result = AsaOutputStorageType.CosmosDbSql; } break; case ALARMS: if (!Enum.TryParse(configData.GetString(ALARMS_STORAGE_TYPE_KEY), true, out result)) { result = AsaOutputStorageType.CosmosDbSql; } break; default: throw new ArgumentOutOfRangeException($"Unknown table name `{tableName}`"); } return(result); }
private static IServicesConfig GetServicesConfig(IConfigData configData) { var messagesStorageType = GetStorageType(configData, MESSAGES); var alarmsStorageType = GetStorageType(configData, ALARMS); return(new ServicesConfig { DeviceTelemetryWebServiceUrl = configData.GetString(DEVICE_TELEMETRY_WEBSERVICE_URL_KEY), DeviceTelemetryWebServiceTimeout = configData.GetInt(DEVICE_TELEMETRY_WEBSERVICE_TIMEOUT_KEY), ConfigServiceUrl = configData.GetString(CONFIG_WEBSERVICE_URL_KEY), ConfigServiceTimeout = configData.GetInt(CONFIG_WEBSERVICE_TIMEOUT_KEY), IotHubManagerServiceUrl = configData.GetString(IOTHUB_MANAGER_WEBSERVICE_URL_KEY), IotHubManagerServiceTimeout = configData.GetInt(IOTHUB_MANAGER_WEBSERVICE_TIMEOUT_KEY), IotHubManagerRetryCount = configData.GetInt(IOTHUB_MANAGER_RETRY_COUNT), InitialIotHubManagerRetryIntervalMs = configData.GetInt(IOTHUB_MANAGER_INITIAL_RETRY_INTERVAL_MS), IotHubManagerRetryIntervalIncreaseFactor = configData.GetInt(IOTHUB_MANAGER_RETRY_INCREASE_FACTOR), MessagesStorageType = messagesStorageType, MessagesCosmosDbConfig = GetAsaOutputStorageConfig(configData, MESSAGES, messagesStorageType), AlarmsStorageType = alarmsStorageType, AlarmsCosmosDbConfig = GetAsaOutputStorageConfig(configData, ALARMS, alarmsStorageType), EventHubConnectionString = configData.GetString(EVENTHUB_CONNECTION_KEY), EventHubName = configData.GetString(EVENTHUB_NAME), EventHubCheckpointTimeMs = configData.GetInt(EVENTHUB_CHECKPOINT_INTERVAL_MS) }); }
private static IDeploymentConfig GetDeploymentConfig(IConfigData configData) { return(new DeploymentConfig { AzureSubscriptionDomain = configData.GetString(AZURE_SUBSCRIPTION_DOMAIN, "undefined.onmicrosoft.com"), AzureSubscriptionId = configData.GetString(AZURE_SUBSCRIPTION_ID, Guid.Empty.ToString()), AzureResourceGroup = configData.GetString(AZURE_RESOURCE_GROUP, "undefined"), AzureIothubName = configData.GetString(AZURE_IOTHUB_NAME, "undefined") }); }
public override void InitWithData(IConfigData data) { if (Id != 0) { Logger.LogError(LogModule.Data, "已经初始化过了!"); return; } Id = data.GetInt("Id"); Desc = data.GetString("Desc"); IntVal = data.GetInt("IntVal"); StrVal = data.GetString("StrVal"); }
private static IServicesConfig GetServicesConfig(IConfigData configData) { var connstring = configData.GetString(IOTHUB_CONNSTRING_KEY); if (connstring.ToLowerInvariant().Contains("connection string")) { // In order to connect to Azure IoT Hub, the service requires a connection // string. The value can be found in the Azure Portal. For more information see // https://docs.microsoft.com/azure/iot-hub/iot-hub-csharp-csharp-getstarted // to find the connection string value. // The connection string can be stored in the 'appsettings.ini' configuration // file, or in the PCS_IOTHUB_CONNSTRING environment variable. When // working with VisualStudio, the environment variable can be set in the // WebService project settings, under the "Debug" tab. ShowIoTHubConnStringInstructions(); throw new Exception("The service configuration is incomplete. " + "Please provide your Azure IoT Hub connection string. " + "For more information, see the environment variables " + "used in project properties and the 'iothub_connstring' " + "value in the 'appsettings.ini' configuration file."); } var hubImportStorageAccount = configData.GetString(IOTHUB_IMPORT_STORAGE_CONNSTRING_KEY); if (hubImportStorageAccount.ToLowerInvariant().Contains("connection string")) { throw new Exception("The service configuration is incomplete. " + "Please provide your Azure Storage Account connection string. " + "For more information, see the environment variables " + "used in project properties and the 'iothub_connstring' " + "value in the 'appsettings.ini' configuration file."); } return(new ServicesConfig { DeviceModelsFolder = MapRelativePath(configData.GetString(DEVICE_MODELS_FOLDER_KEY)), DeviceModelsScriptsFolder = MapRelativePath(configData.GetString(DEVICE_MODELS_SCRIPTS_FOLDER_KEY)), IoTHubDataFolder = MapRelativePath(configData.GetString(IOTHUB_DATA_FOLDER_KEY)), IoTHubConnString = connstring, IoTHubImportStorageAccount = hubImportStorageAccount, IoTHubSdkDeviceClientTimeout = configData.GetOptionalUInt(IOTHUB_SDK_DEVICE_CLIENT_TIMEOUT_KEY), StorageAdapterApiUrl = configData.GetString(STORAGE_ADAPTER_API_URL_KEY), StorageAdapterApiTimeout = configData.GetInt(STORAGE_ADAPTER_API_TIMEOUT_KEY), AzureManagementAdapterApiUrl = configData.GetString(AZURE_MANAGEMENT_ADAPTER_API_URL_KEY), AzureManagementAdapterApiTimeout = configData.GetInt(AZURE_MANAGEMENT_ADAPTER_API_TIMEOUT_KEY), AzureManagementAdapterApiVersion = configData.GetString(AZURE_MANAGEMENT_ADAPTER_API_VERSION), TwinReadWriteEnabled = configData.GetBool(TWIN_READ_WRITE_ENABLED_KEY, true), MainStorage = GetStorageConfig(configData, MAIN_STORAGE_KEY), NodesStorage = GetStorageConfig(configData, NODES_STORAGE_KEY), SimulationsStorage = GetStorageConfig(configData, SIMULATIONS_STORAGE_KEY), DevicesStorage = GetStorageConfig(configData, DEVICES_STORAGE_KEY), PartitionsStorage = GetStorageConfig(configData, PARTITIONS_STORAGE_KEY), DiagnosticsEndpointUrl = configData.GetString(LOGGING_DIAGNOSTICS_URL_KEY) }); }
public Config(IConfigData configData) { this.Port = configData.GetInt(PORT_KEY); var connstring = configData.GetString(IOTHUB_CONNSTRING_KEY); if (connstring.ToLowerInvariant().Contains("your azure iot hub")) { // In order to connect to Azure IoT Hub, the service requires a connection // string. The value can be found in the Azure Portal. For more information see // https://docs.microsoft.com/azure/iot-hub/iot-hub-csharp-csharp-getstarted // to find the connection string value. // The connection string can be stored in the 'appsettings.ini' configuration // file, or in the PCS_IOTHUB_CONNSTRING environment variable. When // working with VisualStudio, the environment variable can be set in the // WebService project settings, under the "Debug" tab. throw new Exception("The service configuration is incomplete. " + "Please provide your Azure IoT Hub connection string. " + "For more information, see the environment variables " + "used in project properties and the 'iothub_connstring' " + "value in the 'appsettings.ini' configuration file."); } this.ServicesConfig = new ServicesConfig { IoTHubConnString = configData.GetString(IOTHUB_CONNSTRING_KEY), DevicePropertiesWhiteList = configData.GetString(DEVICE_PROPERTIES_WHITELIST_KEY), DevicePropertiesTTL = configData.GetInt(DEVICE_PROPERTIES_TTL_KEY), DevicePropertiesRebuildTimeout = configData.GetInt(DEVICE_PROPERTIES_REBUILD_TIMEOUT_KEY), StorageAdapterApiUrl = configData.GetString(STORAGE_ADAPTER_URL_KEY), UserManagementApiUrl = configData.GetString(USER_MANAGEMENT_URL_KEY) }; this.ClientAuthConfig = new ClientAuthConfig { // By default CORS is disabled CorsWhitelist = configData.GetString(CORS_WHITELIST_KEY, string.Empty), // By default Auth is required AuthRequired = configData.GetBool(AUTH_REQUIRED_KEY, true), // By default auth type is JWT AuthType = configData.GetString(AUTH_TYPE_KEY, "JWT"), // By default the only trusted algorithms are RS256, RS384, RS512 JwtAllowedAlgos = configData.GetString(JWT_ALGOS_KEY, "RS256,RS384,RS512").Split(','), JwtIssuer = configData.GetString(JWT_ISSUER_KEY), JwtAudience = configData.GetString(JWT_AUDIENCE_KEY), // By default the allowed clock skew is 2 minutes JwtClockSkew = TimeSpan.FromSeconds(configData.GetInt(JWT_CLOCK_SKEW_KEY, 120)), // By default the time to live for the OpenId connect token is 7 days OpenIdTimeToLive = TimeSpan.FromDays(configData.GetInt(OPEN_ID_TTL_KEY, 7)) }; }
private static StorageConfig GetStorageConfig(IConfigData configData, string prefix) { var defaults = new StorageConfig(); return(new StorageConfig { StorageType = configData.GetString(prefix + STORAGE_TYPE_KEY, defaults.StorageType), MaxPendingOperations = configData.GetInt(STORAGE_MAX_PENDING_OPERATIONS, defaults.MaxPendingOperations), DocumentDbConnString = configData.GetString(prefix + DOCUMENTDB_CONNECTION_STRING_KEY), DocumentDbDatabase = configData.GetString(prefix + DOCUMENTDB_DATABASE_KEY), DocumentDbCollection = configData.GetString(prefix + DOCUMENTDB_COLLECTION_KEY), DocumentDbThroughput = configData.GetInt(prefix + DOCUMENTDB_THROUGHPUT_KEY, defaults.DocumentDbThroughput) }); }
public Config(IConfigData configData) { Enum.TryParse(configData.GetString(LOG_LEVEL_KEY, LOG_LEVEL_DEFAULT.ToString()), out LogLevel logLevel); this.LogLevel = logLevel; this.StatusEndpointEnabled = configData.GetBool(STATUS_ENDPOINT_ENABLED_KEY, STATUS_ENDPOINT_ENABLED_DEFAULT); this.MaxPayloadSize = configData.GetInt(MAX_PAYLOAD_SIZE_KEY, MAX_PAYLOAD_SIZE_DEFAULT); this.RedirectHttpToHttps = configData.GetBool(REDIRECT_HTTP_KEY, REDIRECT_HTTP_DEFAULT); this.StrictTransportSecurityEnabled = configData.GetBool(STS_ENABLED_KEY, STS_ENABLED_DEFAULT); this.StrictTransportSecurityPeriod = configData.GetInt(STS_PERIOD_KEY, STS_PERIOD_DEFAULT); this.SslCertThumbprint = configData.GetString(SSL_CERT_THUMBPRINT_KEY); }
private static IDeploymentConfig GetDeploymentConfig(IConfigData configData) { return(new DeploymentConfig { AzureSubscriptionDomain = configData.GetString(AZURE_SUBSCRIPTION_DOMAIN, "undefined.onmicrosoft.com"), AzureSubscriptionId = configData.GetString(AZURE_SUBSCRIPTION_ID, Guid.Empty.ToString()), AzureResourceGroup = configData.GetString(AZURE_RESOURCE_GROUP, "undefined"), AzureResourceGroupLocation = configData.GetString(AZURE_RESOURCE_GROUP_LOCATION, "undefined"), AzureIothubName = configData.GetString(AZURE_IOTHUB_NAME, "undefined"), AzureVmssName = configData.GetString(AZURE_VMSS_NAME, "undefined"), AadTenantId = configData.GetString(AAD_TENANT_ID, "undefined"), AadAppId = configData.GetString(AAD_APP_ID, "undefined"), AadAppSecret = configData.GetString(AAD_APP_SECRET, "undefined"), AadTokenUrl = configData.GetString(AAD_ACCESS_TOKEN_URL, "undefinedd") }); }
/// <summary>Read storage configuration, depending on the storage type</summary> /// <param name="configData">Raw configuration data</param> /// <param name="tableName">Name of the table</param> /// <param name="storageType">Type of storage, e.g. CosmosDbSql</param> private static CosmosDbTableConfiguration GetAsaOutputStorageConfig( IConfigData configData, string tableName, AsaOutputStorageType storageType) { string prefix; // All tables have the same configuration block, with a different prefix switch (tableName) { case MESSAGES: prefix = MESSAGES_KEY; break; case ALARMS: prefix = ALARMS_KEY; break; default: throw new ArgumentOutOfRangeException("Unknown table " + tableName); } // If the table is on CosmosDb, read the configuration parameters if (storageType == AsaOutputStorageType.CosmosDbSql) { var consistency = configData.GetString(prefix + COSMOSDBSQL_CONSISTENCY_KEY); if (!Enum.TryParse <ConsistencyLevel>(consistency, true, out var consistencyLevel)) { consistencyLevel = ConsistencyLevel.Eventual; } return(new CosmosDbTableConfiguration { Api = CosmosDbApi.Sql, ConnectionString = configData.GetString(prefix + COSMOSDBSQL_CONNSTRING_KEY), Database = configData.GetString(prefix + COSMOSDBSQL_DATABASE_KEY), Collection = configData.GetString(prefix + COSMOSDBSQL_COLLECTION_KEY), ConsistencyLevel = consistencyLevel, RUs = configData.GetInt(prefix + COSMOSDBSQL_RUS_KEY), }); } // If another storage type is added, add a similar block here, // and change the output type to allow multiple types. Not needed now. return(null); }
public Config(IConfigData configData) { this.Port = configData.GetInt(PORT); this.ServicesConfig = new ServicesConfig { SqlConnectionString = configData.GetString(SQL_CONNECTION_STRING) }; }
private static IClientAuthConfig GetClientAuthConfig(IConfigData configData) { return(new ClientAuthConfig { // By default CORS is disabled CorsWhitelist = configData.GetString(CORS_WHITELIST_KEY, string.Empty), // By default Auth is required AuthRequired = configData.GetBool(AUTH_REQUIRED_KEY, true), // By default auth type is JWT AuthType = configData.GetString(AUTH_TYPE_KEY, "JWT"), // By default the only trusted algorithms are RS256, RS384, RS512 JwtAllowedAlgos = configData.GetString(JWT_ALGOS_KEY, "RS256,RS384,RS512").Split(','), JwtIssuer = configData.GetString(JWT_ISSUER_KEY, String.Empty), JwtAudience = configData.GetString(JWT_AUDIENCE_KEY, String.Empty), // By default the allowed clock skew is 2 minutes JwtClockSkew = TimeSpan.FromSeconds(configData.GetInt(JWT_CLOCK_SKEW_KEY, 120)), }); }
private static IBlobStorageConfig GetBlobStorageConfig(IConfigData configData) { return(new BlobStorageConfig { ReferenceDataContainer = configData.GetString(STORAGE_REFERENCE_DATA_CONTAINER_KEY), EventHubContainer = configData.GetString(STORAGE_EVENTHUB_CONTAINER_KEY), AccountKey = configData.GetString(STORAGE_ACCOUNT_KEY_KEY), AccountName = configData.GetString(STORAGE_ACCOUNT_NAME_KEY), EndpointSuffix = configData.GetString(STORAGE_ACCOUNT_ENDPOINT_KEY, STORAGE_ACCOUNT_ENDPOINT_DEFAULT), ReferenceDataDeviceGroupsFileName = configData.GetString(STORAGE_DEVICE_GROUPS_FILE_NAME), ReferenceDataRulesFileName = configData.GetString(STORAGE_RULES_FILE_NAME), ReferenceDataDateFormat = configData.GetString(STORAGE_DATE_FORMAT), ReferenceDataTimeFormat = configData.GetString(STORAGE_TIME_FORMAT) }); }
public string GetString(string sName) { IConfigData iData = null; if (RowDataMap.TryGetValue(sName, out iData)) { return(iData.GetString()); } return(""); }
public Config(IConfigData configData) { Enum.TryParse(configData.GetString(LOG_LEVEL_KEY, LOG_LEVEL_DEFAULT.ToString()), out LogLevel logLevel); this.LogLevel = logLevel; this.StatusEndpointEnabled = configData.GetBool(STATUS_ENDPOINT_ENABLED_KEY, STATUS_ENDPOINT_ENABLED_DEFAULT); this.MaxPayloadSize = configData.GetInt(MAX_PAYLOAD_SIZE_KEY, MAX_PAYLOAD_SIZE_DEFAULT); this.RedirectHttpToHttps = configData.GetBool(REDIRECT_HTTP_KEY, REDIRECT_HTTP_DEFAULT); this.StrictTransportSecurityEnabled = configData.GetBool(STS_ENABLED_KEY, STS_ENABLED_DEFAULT); this.StrictTransportSecurityPeriod = configData.GetInt(STS_PERIOD_KEY, STS_PERIOD_DEFAULT); this.Endpoint = configData.GetString(ENDPOINT_KEY); this.SslCertThumbprint = configData.GetString(SSL_CERT_THUMBPRINT_KEY); if (string.IsNullOrEmpty(this.Endpoint)) { throw new InvalidConfigurationException("The remote endpoint hostname is empty."); } }
public Config(IConfigData configData) { var connstring = configData.GetString(IOTHUB_CONNSTRING_KEY); if (connstring.ToLowerInvariant().Contains("your azure iot hub")) { // In order to connect to Azure IoT Hub, the service requires a connection // string. The value can be found in the Azure Portal. For more information see // https://docs.microsoft.com/azure/iot-hub/iot-hub-csharp-csharp-getstarted // to find the connection string value. // The connection string can be stored in the 'appsettings.ini' configuration // file, or in the PCS_IOTHUB_CONNSTRING environment variable. When // working with VisualStudio, the environment variable can be set in the // WebService project settings, under the "Debug" tab. throw new Exception("The service configuration is incomplete. " + "Please provide your Azure IoT Hub connection string. " + "For more information, see the environment variables " + "used in project properties and the 'iothub_connstring' " + "value in the 'appsettings.ini' configuration file."); } var limitsConf = new RateLimitingConfiguration { ConnectionsPerSecond = configData.GetInt(CONNECTIONS_FREQUENCY_LIMIT_KEY, 50), RegistryOperationsPerMinute = configData.GetInt(REGISTRYOPS_FREQUENCY_LIMIT_KEY, 50), DeviceMessagesPerSecond = configData.GetInt(DEVICE_MESSAGES_FREQUENCY_LIMIT_KEY, 50), DeviceMessagesPerDay = configData.GetInt(DEVICE_MESSAGES_DAILY_LIMIT_KEY, 8000), TwinReadsPerSecond = configData.GetInt(TWIN_READS_FREQUENCY_LIMIT_KEY, 5), TwinWritesPerSecond = configData.GetInt(TWIN_WRITES_FREQUENCY_LIMIT_KEY, 5) }; this.ServicesConfig = new ServicesConfig { DeviceModelsFolder = MapRelativePath(configData.GetString(DEVICE_MODELS_FOLDER_KEY)), DeviceModelsScriptsFolder = MapRelativePath(configData.GetString(DEVICE_MODELS_SCRIPTS_FOLDER_KEY)), IoTHubConnString = connstring, StorageAdapterApiUrl = configData.GetString(STORAGE_ADAPTER_API_URL_KEY), StorageAdapterApiTimeout = configData.GetInt(STORAGE_ADAPTER_API_TIMEOUT_KEY), RateLimiting = limitsConf }; }
public Config(IConfigData configData) { this.Port = configData.GetInt(PortKey); this.ServicesConfig = new ServicesConfig { PcsConfigUrl = configData.GetString(PCS_CONFIG_URL), SolutionType = configData.GetString(PCS_SOLUTION_TYPE), DeploymentId = configData.GetString(PCS_DEPLOYMENT_ID), SubscriptionId = configData.GetString(PCS_SUBSCRIPTION_ID), CloudType = configData.GetString(PCS_CLOUD_TYPE), IoTHubName = configData.GetString(PCS_IOTHUB_NAME), SolutionName = configData.GetString(PCS_SOLUTION_NAME), UserConsentPollingIntervalSecs = configData.GetInt(USER_CONSENT_POLLING_INTERVAL_KEY, 300), AppInsightsInstrumentationKey = configData.GetString(APPINSIGHTS_INSTRUMENTATION_KEY) }; this.ClientAuthConfig = new ClientAuthConfig { // By default CORS is disabled CorsWhitelist = configData.GetString(CORS_WHITELIST_KEY, string.Empty), // By default Auth is required AuthRequired = configData.GetBool(AUTH_REQUIRED_KEY, true), // By default auth type is JWT AuthType = configData.GetString(AUTH_TYPE_KEY, "JWT"), // By default the only trusted algorithms are RS256, RS384, RS512 JwtAllowedAlgos = configData.GetString(JWT_ALGOS_KEY, "RS256,RS384,RS512").Split(','), JwtIssuer = configData.GetString(JWT_ISSUER_KEY, String.Empty), JwtAudience = configData.GetString(JWT_AUDIENCE_KEY, String.Empty), // By default the allowed clock skew is 2 minutes JwtClockSkew = TimeSpan.FromSeconds(configData.GetInt(JWT_CLOCK_SKEW_KEY, 120)), }; }
public Config(IConfigData configData) { this.Port = configData.GetInt(PORT_KEY); this.ServicesConfig = new ServicesConfig { MessagesConfig = new StorageConfig( configData.GetString(MESSAGES_DB_DATABASE_KEY), configData.GetString(MESSAGES_DB_COLLECTION_KEY)), AlarmsConfig = new AlarmsConfig( configData.GetString(ALARMS_DB_DATABASE_KEY), configData.GetString(ALARMS_DB_COLLECTION_KEY), configData.GetInt(ALARMS_DB_MAX_DELETE_RETRIES)), StorageType = configData.GetString(MESSAGES_STORAGE_TYPE), CosmosDbConnString = configData.GetString(COSMOSDB_CONNSTRING_KEY), CosmosDbThroughput = configData.GetInt(COSMOSDB_RUS_KEY), StorageAdapterApiUrl = configData.GetString(STORAGE_ADAPTER_API_URL_KEY), StorageAdapterApiTimeout = configData.GetInt(STORAGE_ADAPTER_API_TIMEOUT_KEY), UserManagementApiUrl = configData.GetString(USER_MANAGEMENT_URL_KEY), TimeSeriesFqdn = configData.GetString(TIME_SERIES_FQDN), TimeSeriesAuthority = configData.GetString(TIME_SERIES_AUTHORITY), TimeSeriesAudience = configData.GetString(TIME_SERIES_AUDIENCE), TimeSeriesExplorerUrl = configData.GetString(TIME_SERIES_EXPLORER_URL), TimeSertiesApiVersion = configData.GetString(TIME_SERIES_API_VERSION), TimeSeriesTimeout = configData.GetString(TIME_SERIES_TIMEOUT), ActiveDirectoryTenant = configData.GetString(AAD_TENANT), ActiveDirectoryAppId = configData.GetString(AAD_APP_ID), ActiveDirectoryAppSecret = configData.GetString(AAD_APP_SECRET), DiagnosticsApiUrl = configData.GetString(DIAGNOSTICS_URL_KEY), DiagnosticsMaxLogRetries = configData.GetInt(DIAGNOSTICS_MAX_LOG_RETRIES) }; this.ClientAuthConfig = new ClientAuthConfig { // By default CORS is disabled CorsWhitelist = configData.GetString(CORS_WHITELIST_KEY, string.Empty), // By default Auth is required AuthRequired = configData.GetBool(AUTH_REQUIRED_KEY, true), // By default auth type is JWT AuthType = configData.GetString(AUTH_TYPE_KEY, "JWT"), // By default the only trusted algorithms are RS256, RS384, RS512 JwtAllowedAlgos = configData.GetString(JWT_ALGOS_KEY, "RS256,RS384,RS512").Split(','), JwtIssuer = configData.GetString(JWT_ISSUER_KEY, String.Empty), JwtAudience = configData.GetString(JWT_AUDIENCE_KEY, String.Empty), // By default the allowed clock skew is 2 minutes JwtClockSkew = TimeSpan.FromSeconds(configData.GetInt(JWT_CLOCK_SKEW_KEY, 120)), }; }
public Config(IConfigData configData) { this.Port = configData.GetInt(PORT_KEY); this.ServicesConfig = new ServicesConfig { JwtUserIdFrom = configData.GetString(JWT_USER_ID_FROM_KEY, "oid").Split(','), JwtNameFrom = configData.GetString(JWT_NAME_FROM_KEY, "given_name,family_name").Split(','), JwtEmailFrom = configData.GetString(JWT_EMAIL_FROM_KEY, "email").Split(','), JwtRolesFrom = configData.GetString(JWT_ROLES_FROM_KEY, "roles"), PoliciesFolder = MapRelativePath(configData.GetString(POLICIES_FOLDER_KEY)), AadEndpointUrl = configData.GetString(AAD_ENDPOINT_URL, DEFAULT_AAD_ENDPOINT_URL), AadTenantId = configData.GetString(AAD_TENANT_ID, String.Empty), AadApplicationId = configData.GetString(AAD_APPLICATION_ID, String.Empty), AadApplicationSecret = configData.GetString(AAD_APPLICATION_SECRET, String.Empty), ArmEndpointUrl = configData.GetString(ARM_ENDPOINT_URL, DEFAULT_ARM_ENDPOINT_URL), }; this.ClientAuthConfig = new ClientAuthConfig { // By default CORS is disabled CorsWhitelist = configData.GetString(CORS_WHITELIST_KEY, string.Empty), // By default Auth is required AuthRequired = configData.GetBool(AUTH_REQUIRED_KEY, true), // By default auth type is JWT AuthType = configData.GetString(AUTH_TYPE_KEY, "JWT"), // By default the only trusted algorithms are RS256, RS384, RS512 JwtAllowedAlgos = configData.GetString(JWT_ALGOS_KEY, "RS256,RS384,RS512").Split(','), JwtIssuer = configData.GetString(JWT_ISSUER_KEY, String.Empty), JwtAudience = configData.GetString(JWT_AUDIENCE_KEY, String.Empty), // By default the allowed clock skew is 2 minutes JwtClockSkew = TimeSpan.FromSeconds(configData.GetInt(JWT_CLOCK_SKEW_KEY, 120)), // By default the time to live for the OpenId connect token is 7 days OpenIdTimeToLive = TimeSpan.FromDays(configData.GetInt(OPEN_ID_TTL_KEY, 7)) }; }
public Config(IConfigData configData) { this.Port = configData.GetInt(PORT_KEY); this.ServicesConfig = new ServicesConfig { MessagesConfig = new StorageConfig( configData.GetString(MESSAGES_DB_DATABASE_KEY), configData.GetString(MESSAGES_DB_COLLECTION_KEY)), AlarmsConfig = new AlarmsConfig( configData.GetString(ALARMS_DB_DATABASE_KEY), configData.GetString(ALARMS_DB_COLLECTION_KEY), configData.GetInt(ALARMS_DB_MAX_DELETE_RETRIES)), StorageType = configData.GetString(STORAGE_TYPE_KEY), DocumentDbConnString = configData.GetString(DOCUMENTDB_CONNSTRING_KEY), DocumentDbThroughput = configData.GetInt(DOCUMENTDB_RUS_KEY), StorageAdapterApiUrl = configData.GetString(STORAGE_ADAPTER_API_URL_KEY), StorageAdapterApiTimeout = configData.GetInt(STORAGE_ADAPTER_API_TIMEOUT_KEY) }; this.ClientAuthConfig = new ClientAuthConfig { // By default CORS is disabled CorsWhitelist = configData.GetString(CORS_WHITELIST_KEY, string.Empty), // By default Auth is required AuthRequired = configData.GetBool(AUTH_REQUIRED_KEY, true), // By default auth type is JWT AuthType = configData.GetString(AUTH_TYPE_KEY, "JWT"), // By default the only trusted algorithms are RS256, RS384, RS512 JwtAllowedAlgos = configData.GetString(JWT_ALGOS_KEY, "RS256,RS384,RS512").Split(','), JwtIssuer = configData.GetString(JWT_ISSUER_KEY, String.Empty), JwtAudience = configData.GetString(JWT_AUDIENCE_KEY, String.Empty), // By default the allowed clock skew is 2 minutes JwtClockSkew = TimeSpan.FromSeconds(configData.GetInt(JWT_CLOCK_SKEW_KEY, 120)), }; }
public Config(IConfigData configData) { IoTHubConfig = new IoTHubConfig { ConnectionConfig = new ConnectionConfig { HubName = configData.GetString(HubNameKey), HubEndpoint = parseIoTHubEndpoint(configData.GetString(HubEndpointKey)), AccessConnString = configData.GetString(AccessConnStringKey) }, StreamingConfig = new StreamingConfig { ConsumerGroup = configData.GetString(ConsumerGroupKey), ReceiveBatchSize = configData.GetInt(ReceiveBatchSizeKey), ReceiveTimeout = configData.GetTimeSpan(ReceiveTimeoutKey) }, CheckpointingConfig = new CheckpointingConfig { Frequency = configData.GetTimeSpan(FrequencyKey), CountThreshold = configData.GetInt(CountThresholdKey), TimeThreshold = configData.GetTimeSpan(TimeThresholdKey), StorageConfig = new CheckpointingStorageConfig { BackendType = configData.GetString(BackendTypeKey), Namespace = configData.GetString(NamespaceKey), AzureBlobConfig = new CheckpointingStorageBlobConfig { Protocol = configData.GetString(ProtocolKey), Account = configData.GetString(AccountKey), Key = configData.GetString(KeyKey), EndpointSuffix = configData.GetString(EndpointSuffixKey) } } } }; ServicesConfig = new ServicesConfig { MonitoringRulesUrl = configData.GetString(MonitoringRulesUrlKey), DeviceGroupsUrl = configData.GetString(DeviceGroupsUrlKey), DevicesUrl = configData.GetString(DevicesUrlKey), MessagesStorageServiceConfig = new StorageServiceConfig { StorageType = configData.GetString(MessagesStorageTypeKey), DocumentDbConnString = configData.GetString(MessagesDocDbConnStringKey), DocumentDbDatabase = configData.GetString(MessagesDocDbDatabaseKey), DocumentDbCollection = configData.GetString(MessagesDocDbCollectionKey), DocumentDbRUs = configData.GetInt(MessagesDocDbRUsKey) }, AlarmsStorageServiceConfig = new StorageServiceConfig { StorageType = configData.GetString(AlarmsStorageTypeKey), DocumentDbConnString = configData.GetString(AlarmsDocDbConnStringKey), DocumentDbDatabase = configData.GetString(AlarmsDocDbDatabaseKey), DocumentDbCollection = configData.GetString(AlarmsDocDbCollectionKey), DocumentDbRUs = configData.GetInt(AlarmsDocDbRUsKey) } }; CheckConfiguration(IoTHubConfig); }
public Config(IConfigData configData) { this.Port = configData.GetInt(PORT_KEY); this.ServicesConfig = new ServicesConfig { MessagesConfig = new StorageConfig( configData.GetString(MESSAGES_DB_DATABASE_KEY), configData.GetString(MESSAGES_DB_COLLECTION_KEY)), AlarmsConfig = new AlarmsConfig( configData.GetString(ALARMS_DB_DATABASE_KEY), configData.GetString(ALARMS_DB_COLLECTION_KEY), configData.GetInt(ALARMS_DB_MAX_DELETE_RETRIES)), StorageType = configData.GetString(MESSAGES_STORAGE_TYPE), CosmosDbConnString = configData.GetString(COSMOSDB_CONNSTRING_KEY), CosmosDbThroughput = configData.GetInt(COSMOSDB_RUS_KEY), StorageAdapterApiUrl = configData.GetString(STORAGE_ADAPTER_API_URL_KEY), StorageAdapterApiTimeout = configData.GetInt(STORAGE_ADAPTER_API_TIMEOUT_KEY), UserManagementApiUrl = configData.GetString(USER_MANAGEMENT_URL_KEY), TimeSeriesFqdn = configData.GetString(TIME_SERIES_FQDN), TimeSeriesAuthority = configData.GetString(TIME_SERIES_AUTHORITY), TimeSeriesAudience = configData.GetString(TIME_SERIES_AUDIENCE), TimeSeriesExplorerUrl = configData.GetString(TIME_SERIES_EXPLORER_URL), TimeSertiesApiVersion = configData.GetString(TIME_SERIES_API_VERSION), TimeSeriesTimeout = configData.GetString(TIME_SERIES_TIMEOUT), ActiveDirectoryTenant = configData.GetString(AAD_TENANT), ActiveDirectoryAppId = configData.GetString(AAD_APP_ID), ActiveDirectoryAppSecret = configData.GetString(AAD_APP_SECRET), DiagnosticsApiUrl = configData.GetString(DIAGNOSTICS_URL_KEY), DiagnosticsMaxLogRetries = configData.GetInt(DIAGNOSTICS_MAX_LOG_RETRIES), ActionsEventHubConnectionString = configData.GetString(ACTIONS_EVENTHUB_CONNSTRING), ActionsEventHubName = configData.GetString(ACTIONS_EVENTHUB_NAME), LogicAppEndpointUrl = configData.GetString(ACTIONS_LOGICAPP_ENDPOINTURL), BlobStorageConnectionString = configData.GetString(ACTIONS_AZUREBLOB_CONNSTRING), ActionsBlobStorageContainer = configData.GetString(ACTIONS_AZUREBLOB_CONTAINER), SolutionUrl = configData.GetString(SOLUTION_URL), TemplateFolder = AppContext.BaseDirectory + Path.DirectorySeparatorChar + configData.GetString(TEMPLATE_FOLDER) }; this.ClientAuthConfig = new ClientAuthConfig { // By default CORS is disabled CorsWhitelist = configData.GetString(CORS_WHITELIST_KEY, string.Empty), // By default Auth is required AuthRequired = configData.GetBool(AUTH_REQUIRED_KEY, true), // By default auth type is JWT AuthType = configData.GetString(AUTH_TYPE_KEY, "JWT"), // By default the only trusted algorithms are RS256, RS384, RS512 JwtAllowedAlgos = configData.GetString(JWT_ALGOS_KEY, "RS256,RS384,RS512").Split(','), JwtIssuer = configData.GetString(JWT_ISSUER_KEY, String.Empty), JwtAudience = configData.GetString(JWT_AUDIENCE_KEY, String.Empty), // By default the allowed clock skew is 2 minutes JwtClockSkew = TimeSpan.FromSeconds(configData.GetInt(JWT_CLOCK_SKEW_KEY, 120)), // By default the time to live for the OpenId connect token is 7 days OpenIdTimeToLive = TimeSpan.FromDays(configData.GetInt(OPEN_ID_TTL_KEY, 7)) }; }
public Config(IConfigData configData) { this.Port = configData.GetInt(PORT_KEY); this.ServicesConfig = new ServicesConfig { StorageAdapterApiUrl = configData.GetString(STORAGE_ADAPTER_URL_KEY), DeviceSimulationApiUrl = configData.GetString(DEVICE_SIMULATION_URL_KEY), TelemetryApiUrl = configData.GetString(TELEMETRY_URL_KEY), SolutionType = configData.GetString(SOLUTION_TYPE_KEY), SeedTemplate = configData.GetString(SEED_TEMPLATE_KEY), AzureMapsKey = configData.GetString(AZURE_MAPS_KEY), UserManagementApiUrl = configData.GetString(USER_MANAGEMENT_URL_KEY), Office365LogicAppUrl = configData.GetString(OFFICE365_LOGIC_APP_URL_KEY), ResourceGroup = configData.GetString(RESOURCE_GROUP_KEY), SubscriptionId = configData.GetString(SUBSCRIPTION_ID_KEY), ManagementApiVersion = configData.GetString(MANAGEMENT_API_VERSION_KEY), ArmEndpointUrl = configData.GetString(ARM_ENDPOINT_URL_KEY) }; this.ClientAuthConfig = new ClientAuthConfig { // By default CORS is disabled CorsWhitelist = configData.GetString(CORS_WHITELIST_KEY, string.Empty), // By default Auth is required AuthRequired = configData.GetBool(AUTH_REQUIRED_KEY, true), // By default auth type is JWT AuthType = configData.GetString(AUTH_TYPE_KEY, "JWT"), // By default the only trusted algorithms are RS256, RS384, RS512 JwtAllowedAlgos = configData.GetString(JWT_ALGOS_KEY, "RS256,RS384,RS512").Split(','), JwtIssuer = configData.GetString(JWT_ISSUER_KEY), JwtAudience = configData.GetString(JWT_AUDIENCE_KEY), // By default the allowed clock skew is 2 minutes JwtClockSkew = TimeSpan.FromSeconds(configData.GetInt(JWT_CLOCK_SKEW_KEY, 120)), }; }
private static IServicesConfig GetServicesConfig(IConfigData configData) { var connstring = configData.GetString(IOTHUB_CONNSTRING_KEY); if (connstring.ToLowerInvariant().Contains("connection string")) { // In order to connect to Azure IoT Hub, the service requires a connection // string. The value can be found in the Azure Portal. For more information see // https://docs.microsoft.com/azure/iot-hub/iot-hub-csharp-csharp-getstarted // to find the connection string value. // The connection string can be stored in the 'appsettings.ini' configuration // file, or in the PCS_IOTHUB_CONNSTRING environment variable. When // working with VisualStudio, the environment variable can be set in the // WebService project settings, under the "Debug" tab. ShowIoTHubConnStringInstructions(); throw new Exception("The service configuration is incomplete. " + "Please provide your Azure IoT Hub connection string. " + "For more information, see the environment variables " + "used in project properties and the 'iothub_connstring' " + "value in the 'appsettings.ini' configuration file."); } var hubImportStorageAccount = configData.GetString(IOTHUB_IMPORT_STORAGE_CONNSTRING_KEY); if (hubImportStorageAccount.ToLowerInvariant().Contains("connection string")) { throw new Exception("The service configuration is incomplete. " + "Please provide your Azure Storage Account connection string. " + "For more information, see the environment variables " + "used in project properties and the 'iothub_connstring' " + "value in the 'appsettings.ini' configuration file."); } var azureManagementAdapterApiUrl = configData.GetString(AZURE_MANAGEMENT_ADAPTER_API_URL_KEY); if (!azureManagementAdapterApiUrl.ToLowerInvariant().StartsWith("https:")) { throw new Exception("The service configuration is incomplete. " + "Azure Management API url must start with https. " + "For more information, see the environment variables " + "used in project properties and the 'webservice_url' " + "value in the 'appsettings.ini' configuration file."); } return(new ServicesConfig { SeedTemplate = configData.GetString(SEED_TEMPLATE_KEY), SeedTemplateFolder = MapRelativePath(configData.GetString(SEED_TEMPLATE_FOLDER_KEY)), DeviceModelsFolder = MapRelativePath(configData.GetString(DEVICE_MODELS_FOLDER_KEY)), DeviceModelsScriptsFolder = MapRelativePath(configData.GetString(DEVICE_MODELS_SCRIPTS_FOLDER_KEY)), IoTHubConnString = connstring, IoTHubImportStorageAccount = hubImportStorageAccount, IoTHubSdkDeviceClientTimeout = configData.GetOptionalUInt(IOTHUB_SDK_DEVICE_CLIENT_TIMEOUT_KEY), StorageAdapterApiUrl = configData.GetString(STORAGE_ADAPTER_API_URL_KEY), StorageAdapterApiTimeout = configData.GetInt(STORAGE_ADAPTER_API_TIMEOUT_KEY), AzureManagementAdapterApiUrl = azureManagementAdapterApiUrl, AzureManagementAdapterApiTimeout = configData.GetInt(AZURE_MANAGEMENT_ADAPTER_API_TIMEOUT_KEY), AzureManagementAdapterApiVersion = configData.GetString(AZURE_MANAGEMENT_ADAPTER_API_VERSION), DeviceTwinEnabled = configData.GetBool(DEVICE_TWIN_ENABLED_KEY, true), C2DMethodsEnabled = configData.GetBool(C_2_D_METHODS_ENABLED_KEY, true), MainStorage = GetStorageConfig(configData, MAIN_STORAGE_KEY), NodesStorage = GetStorageConfig(configData, NODES_STORAGE_KEY), SimulationsStorage = GetStorageConfig(configData, SIMULATIONS_STORAGE_KEY), DevicesStorage = GetStorageConfig(configData, DEVICES_STORAGE_KEY), PartitionsStorage = GetStorageConfig(configData, PARTITIONS_STORAGE_KEY), UserAgent = configData.GetString(USER_AGENT_KEY, DEFAULT_USER_AGENT_STRING), StatisticsStorage = GetStorageConfig(configData, STATISTICS_STORAGE_KEY), DiagnosticsEndpointUrl = configData.GetString(LOGGING_DIAGNOSTICS_URL_KEY), DevelopmentMode = configData.GetBool(DEBUGGING_DEVELOPMENT_MODE_KEY, false), DisableSimulationAgent = configData.GetBool(DEBUGGING_DISABLE_SIMULATION_AGENT_KEY, false), DisablePartitioningAgent = configData.GetBool(DEBUGGING_DISABLE_PARTITIONING_AGENT_KEY, false), DisableSeedByTemplate = configData.GetBool(DEBUGGING_DISABLE_SEED_BY_TEMPLATE_KEY, false) }); }