public PSFileService(ConfigurationService config, ILogger logger) { _logger = logger.ForContext <PSFileService>(); string scriptPath = config.GetSetting("scriptpath", Path.GetDirectoryName(typeof(PSExecutor).Assembly.Location)); _scriptPaths = scriptPath.Split(',', ';') .Where(x => !string.IsNullOrWhiteSpace(x)) .Select(x => x.Trim()) .ToArray(); _logger.Information("{PathCount} script paths configured", _scriptPaths.Length); }
public IoTDevice(PSExecutor psExecutor, ConfigurationService config, ILogger logger) { _logger = logger.ForContext <IoTDevice>(); _psExecutor = psExecutor; _handlers = new Dictionary <string, MethodCallback> { { nameof(ListScripts), ListScripts }, { nameof(ExecuteScript), ExecuteScriptAsyncWrapper } }; string connectionString = config.GetSetting("iothub"); _deviceClient = DeviceClient.CreateFromConnectionString(connectionString); }
public IoTHubDevice(PSExecutor psExecutor, ConfigurationService config, ILogger logger) { _logger = logger.ForContext <IoTHubDevice>(); _psExecutor = psExecutor; _handlers = new Dictionary <string, MethodCallback> { { nameof(ListScripts), ListScripts }, { nameof(ExecuteScript), ExecuteScriptAsyncWrapper } }; string connectionString = config.GetSetting("iothub"); _deviceClient = DeviceClient.CreateFromConnectionString(connectionString); IRetryPolicy retryPolicy = new ExponentialBackoff(int.MaxValue, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(30), TimeSpan.FromSeconds(1)); _deviceClient.SetRetryPolicy(retryPolicy); }
public PSExecutor(ConfigurationService config, ILogger logger) { _scriptPath = config.GetSetting("scriptpath", Path.GetDirectoryName(typeof(PSExecutor).Assembly.Location)); _logger = logger.ForContext <PSExecutor>(); }