Beispiel #1
0
        public virtual void ConfigureServices(IServiceCollection serviceCollection, WorkerConfiguration config)
        {
            var client = RegisterElasticClient(serviceCollection, config);

            ConfigureLogging(config.ElasticsearchUrl);
            ConfigureServices(serviceCollection, client, config);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Log.Information("Worker Starting");
            var environment = Environment.GetEnvironmentVariable("DD_ENVIRONMENT");
            var builder     = new ConfigurationBuilder()
                              .SetBasePath(Directory.GetCurrentDirectory())
                              .AddJsonFile("appsettings.json", true)
                              .AddEnvironmentVariables("DD_");

            if (!string.IsNullOrEmpty(environment))
            {
                builder.AddJsonFile("appsettings." + environment.ToLowerInvariant() + ".json");
            }
            var configuration = builder.Build();
            var workerConfig  = new WorkerConfiguration();

            configuration.Bind(workerConfig);
            workerConfig.LogSettings();
            var serviceCollection = new ServiceCollection();
            var startup           = new Startup();

            startup.ConfigureServices(serviceCollection, workerConfig);
            var services    = serviceCollection.BuildServiceProvider();
            var application = new Application(services);

            Task.Run(application.Run);

            Console.CancelKeyPress += (o, e) =>
            {
                Console.WriteLine("Exit");
                WaitHandle.Set();
            };

            WaitHandle.WaitOne();
        }
 public GitCommandProcessorFactory(IGitHubClientFactory clientFactory, IGitWrapperFactory wrapperFactory,
                                   WorkerConfiguration config)
 {
     _clientFactory  = clientFactory;
     _wrapperFactory = wrapperFactory;
     _config         = config;
 }
 public DataDockRepositoryFactory(WorkerConfiguration config,
                                  IQuinceStoreFactory quinceStoreFactory,
                                  IFileGeneratorFactory fileGeneratorFactory,
                                  IDataDockUriService uriService)
 {
     _config               = config;
     _quinceStoreFactory   = quinceStoreFactory;
     _fileGeneratorFactory = fileGeneratorFactory;
     _uriService           = uriService;
 }
Beispiel #5
0
        protected void ConfigureServices(IServiceCollection serviceCollection, IElasticClient elasticClient,
                                         WorkerConfiguration config)
        {
            serviceCollection.AddSingleton(config);
            serviceCollection.AddSingleton <ApplicationConfiguration>(config);
            serviceCollection.AddScoped <IFileStore, DirectoryFileStore>();

            serviceCollection.AddSingleton <IDataDockUriService>(new DataDockUriService(config.PublishUrl));
            serviceCollection.AddSingleton <IDatasetStore, DatasetStore>();
            serviceCollection.AddSingleton <IJobStore, JobStore>();
            serviceCollection.AddSingleton <IUserStore, UserStore>();
            serviceCollection.AddSingleton <IOwnerSettingsStore, OwnerSettingsStore>();
            serviceCollection.AddSingleton <IRepoSettingsStore, RepoSettingsStore>();
            serviceCollection.AddSingleton <ISchemaStore, SchemaStore>();
            serviceCollection.AddSingleton <IProgressLogFactory, SignalRProgressLogFactory>();
            serviceCollection.AddSingleton <ILogStore, DirectoryLogStore>();
            serviceCollection.AddSingleton <IGitHubClientFactory>(new GitHubClientFactory(config.GitHubClientHeader));
            serviceCollection.AddSingleton <IGitWrapperFactory>(new DefaultGitWrapperFactory(config.GitPath));
            serviceCollection.AddSingleton <IQuinceStoreFactory, DefaultQuinceStoreFactory>();
            serviceCollection.AddTransient <IFileGeneratorFactory, FileGeneratorFactory>();
            serviceCollection.AddTransient <IDataDockRepositoryFactory, DataDockRepositoryFactory>();
            serviceCollection.AddSingleton <IGitCommandProcessorFactory, GitCommandProcessorFactory>();
        }
 public SignalRProgressLogFactory(WorkerConfiguration configuration, IJobStore jobRepository)
 {
     _hubConnectionUrl = configuration.SignalRHubUrl;
     _jobRepository    = jobRepository;
 }