using Microsoft.AspNetCore.Components.Web; using Microsoft.AspNetCore.Components.WebAssembly.Hosting; using Microsoft.Extensions.Configuration; using Front; using Front.Program.Services; using Front.Program.ViewModels; const bool local = true; var builder = WebAssemblyHostBuilder.CreateDefault(args); Func checkLocal = (isLocal) => { if (isLocal) return new Uri("http://0.0.0.0:5144"); else return builder.HostEnvironment.IsDevelopment() ? new Uri("https://devacamate.ipstein.myds.me") : new Uri("https://acamate.ipstein.myds.me"); }; if (local) { builder.Logging.SetMinimumLevel(LogLevel.Debug); } else { builder.Logging.SetMinimumLevel(builder.HostEnvironment.IsDevelopment() ? LogLevel.Debug: LogLevel.Warning); } builder.RootComponents.Add("#app"); builder.RootComponents.Add("head::after"); // 설정 파일 로드 // builder.Configuration.AddJsonFile("appsettings.json", optional: false); builder.Configuration.AddJsonFile($"appsettings.{builder.HostEnvironment.Environment}.json", optional: true); builder.Services.AddScoped(sp => //new HttpClient { var config = builder.Configuration; var http = new HttpClient { // 서버 올릴때는 이 부분을 꼭 확인 할 것 // true 면 로컬 / false 면 배포 BaseAddress = checkLocal(local) }; return http; }); // SCOPED 으로 등록된 서비스는 DI 컨테이너에 등록된 서비스의 인스턴스를 사용합니다. builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); builder.Services.AddScoped(); await builder.Build().RunAsync();