Exemplo n.º 1
0
        static async Task Main(string[] args)
        {
            IConfiguration config = new ConfigurationBuilder()
                                    .AddJsonFile("appsettings.json", true, true)
                                    .Build();

            config = DependencyBootstrapper.AddSecrets(config);

            var services = new ServiceCollection();

            DependencyBootstrapper.ConfigureDependencies(services, config);

            var provider = services.BuildServiceProvider();

            var context = provider.GetService <MusicLibraryContext>();

            var libMan       = provider.GetService <LibraryService>();
            var saveWorkflow = new SaveNewFilesToDatabaseWorkflow(libMan);

            foreach (var path in args)
            {
                await saveWorkflow.Execute(path);
            }

            var uploadWorkflow = new UploadFilesToAzureWorkflow(context, provider.GetService <IDriveServiceFactory>(), libMan);
            await uploadWorkflow.Execute();
        }
Exemplo n.º 2
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                Configuration = DependencyBootstrapper.AddSecrets(Configuration);
            }

            app.UseRouting();
            app.UseCors("enable-all");

            app.UseAuthentication();
            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllers();
            });
        }