Beispiel #1
0
        public WebScriptHostManager(ScriptHostConfiguration config, ISecretManagerFactory secretManagerFactory, ScriptSettingsManager settingsManager, WebHostSettings webHostSettings, IScriptHostFactory scriptHostFactory = null, ISecretsRepositoryFactory secretsRepositoryFactory = null)
            : base(config, settingsManager, scriptHostFactory)
        {
            _config           = config;
            _metricsLogger    = new WebHostMetricsLogger();
            _exceptionHandler = new WebScriptHostExceptionHandler(this);
            _webHostSettings  = webHostSettings;

            var systemEventGenerator = config.HostConfig.GetService <IEventGenerator>() ?? new EventGenerator();
            var systemTraceWriter    = new SystemTraceWriter(systemEventGenerator, settingsManager, TraceLevel.Verbose);

            if (config.TraceWriter != null)
            {
                config.TraceWriter = new CompositeTraceWriter(new TraceWriter[] { config.TraceWriter, systemTraceWriter });
            }
            else
            {
                config.TraceWriter = systemTraceWriter;
            }

            config.IsSelfHost = webHostSettings.IsSelfHost;

            _performanceManager     = new HostPerformanceManager(settingsManager, config.TraceWriter);
            _swaggerDocumentManager = new SwaggerDocumentManager(config);

            var secretsRepository = secretsRepositoryFactory.Create(settingsManager, webHostSettings, config);

            _secretManager = secretManagerFactory.Create(settingsManager, config.TraceWriter, secretsRepository);
        }
        public WebScriptHostManager(ScriptHostConfiguration config,
                                    ISecretManagerFactory secretManagerFactory,
                                    IScriptEventManager eventManager,
                                    ScriptSettingsManager settingsManager,
                                    WebHostSettings webHostSettings,
                                    IWebJobsRouter router,
                                    ILoggerFactory loggerFactory,
                                    IScriptHostFactory scriptHostFactory = null,
                                    ISecretsRepositoryFactory secretsRepositoryFactory = null,
                                    HostPerformanceManager hostPerformanceManager      = null,
                                    ILoggerProviderFactory loggerProviderFactory       = null,
                                    int hostTimeoutSeconds = 30,
                                    int hostPollingIntervalMilliseconds = 500)
            : base(config, settingsManager, scriptHostFactory, eventManager, environment: null,
                   hostPerformanceManager: hostPerformanceManager, loggerProviderFactory: loggerProviderFactory)
        {
            _config = config;

            _metricsLogger      = new WebHostMetricsLogger();
            _exceptionHandler   = new WebScriptHostExceptionHandler(this);
            _webHostSettings    = webHostSettings;
            _settingsManager    = settingsManager;
            _hostTimeoutSeconds = hostTimeoutSeconds;
            _hostRunningPollIntervalMilliseconds = hostPollingIntervalMilliseconds;
            _router = router;

            config.IsSelfHost = webHostSettings.IsSelfHost;

            secretsRepositoryFactory = secretsRepositoryFactory ?? new DefaultSecretsRepositoryFactory();
            var secretsRepository = secretsRepositoryFactory.Create(settingsManager, webHostSettings, config);

            _secretManager = secretManagerFactory.Create(settingsManager, loggerFactory.CreateLogger(ScriptConstants.LogCategoryHostGeneral), secretsRepository);

            _bindingWebHookProvider = new WebJobsSdkExtensionHookProvider(_secretManager);
        }
        public WebScriptHostManager(ScriptHostConfiguration config,
                                    ISecretManagerFactory secretManagerFactory,
                                    IScriptEventManager eventManager,
                                    ScriptSettingsManager settingsManager,
                                    WebHostSettings webHostSettings,
                                    IWebJobsRouter router,
                                    IScriptHostFactory scriptHostFactory = null,
                                    ISecretsRepositoryFactory secretsRepositoryFactory = null,
                                    ILoggerFactoryBuilder loggerFactoryBuilder         = null,
                                    HostPerformanceManager hostPerformanceManager      = null,
                                    int hostTimeoutSeconds = 30,
                                    int hostPollingIntervalMilliseconds = 500)
            : base(config, settingsManager, scriptHostFactory, eventManager, environment: null, loggerFactoryBuilder: loggerFactoryBuilder, hostPerformanceManager: hostPerformanceManager)
        {
            _config = config;

            _metricsLogger      = new WebHostMetricsLogger();
            _exceptionHandler   = new WebScriptHostExceptionHandler(this);
            _webHostSettings    = webHostSettings;
            _hostTimeoutSeconds = hostTimeoutSeconds;
            _hostRunningPollIntervalMilliseconds = hostPollingIntervalMilliseconds;
            _router = router;

            var systemEventGenerator = config.HostConfig.GetService <IEventGenerator>() ?? new EventGenerator();
            var systemTraceWriter    = new SystemTraceWriter(systemEventGenerator, settingsManager, TraceLevel.Verbose);

            if (config.TraceWriter != null)
            {
                config.TraceWriter = new CompositeTraceWriter(new TraceWriter[] { config.TraceWriter, systemTraceWriter });
            }
            else
            {
                config.TraceWriter = systemTraceWriter;
            }

            config.IsSelfHost = webHostSettings.IsSelfHost;

            secretsRepositoryFactory = secretsRepositoryFactory ?? new DefaultSecretsRepositoryFactory();
            var secretsRepository = secretsRepositoryFactory.Create(settingsManager, webHostSettings, config);

            _secretManager = secretManagerFactory.Create(settingsManager, config.HostConfig.LoggerFactory, secretsRepository);

            _bindingWebHookProvider = new WebJobsSdkExtensionHookProvider(_secretManager);
        }
        public WebScriptHostManager(ScriptHostConfiguration config, ISecretManagerFactory secretManagerFactory, ScriptSettingsManager settingsManager, WebHostSettings webHostSettings, IScriptHostFactory scriptHostFactory = null)
            : base(config, settingsManager, scriptHostFactory)
        {
            _config = config;
            _metricsLogger = new WebHostMetricsLogger();
            _exceptionHandler = new WebScriptHostExceptionHandler(this);
            _webHostSettings = webHostSettings;

            var systemEventGenerator = config.HostConfig.GetService<IEventGenerator>() ?? new EventGenerator();
            var systemTraceWriter = new SystemTraceWriter(systemEventGenerator, settingsManager, TraceLevel.Verbose);
            if (config.TraceWriter != null)
            {
                config.TraceWriter = new CompositeTraceWriter(new TraceWriter[] { config.TraceWriter, systemTraceWriter });
            }
            else
            {
                config.TraceWriter = systemTraceWriter;
            }

            _secretManager = secretManagerFactory.Create(settingsManager, config.TraceWriter, webHostSettings.SecretsPath);
        }
        public WebScriptHostManager(ScriptHostConfiguration config, ISecretManagerFactory secretManagerFactory, ScriptSettingsManager settingsManager, WebHostSettings webHostSettings, IScriptHostFactory scriptHostFactory = null)
            : base(config, settingsManager, scriptHostFactory)
        {
            _config           = config;
            _metricsLogger    = new WebHostMetricsLogger();
            _exceptionHandler = new WebScriptHostExceptionHandler(this);
            _webHostSettings  = webHostSettings;

            var systemEventGenerator = config.HostConfig.GetService <IEventGenerator>() ?? new EventGenerator();
            var systemTraceWriter    = new SystemTraceWriter(systemEventGenerator, settingsManager, TraceLevel.Verbose);

            if (config.TraceWriter != null)
            {
                config.TraceWriter = new CompositeTraceWriter(new TraceWriter[] { config.TraceWriter, systemTraceWriter });
            }
            else
            {
                config.TraceWriter = systemTraceWriter;
            }

            _secretManager = secretManagerFactory.Create(settingsManager, config.TraceWriter, new FileSystemSecretsRepository(webHostSettings.SecretsPath));
        }