public RootConfig() { Logging = new LoggingConfig(); Proxy = new ProxyConfig(); EndpointDefinition = AWSConfigs._endpointDefinition; Region = AWSConfigs._awsRegion; ProfileName = AWSConfigs._awsProfileName; ProfilesLocation = AWSConfigs._awsAccountsLocation; UseSdkCache = AWSConfigs._useSdkCache; CorrectForClockSkew = true; #if !PCL var root = AWSConfigs.GetSection<AWSSection>(_rootAwsSectionName); Logging.Configure(root.Logging); Proxy.Configure(root.Proxy); ServiceSections = root.ServiceSections; if (root.UseSdkCache.HasValue) UseSdkCache = root.UseSdkCache.Value; EndpointDefinition = Choose(EndpointDefinition, root.EndpointDefinition); Region = Choose(Region, root.Region); ProfileName = Choose(ProfileName, root.ProfileName); ProfilesLocation = Choose(ProfilesLocation, root.ProfilesLocation); ApplicationName = Choose(ApplicationName, root.ApplicationName); if (root.CorrectForClockSkew.HasValue) CorrectForClockSkew = root.CorrectForClockSkew.Value; #endif }
public void Configuration(IAppBuilder app) { // For more information on how to configure your application, visit http://go.microsoft.com/fwlink/?LinkID=316888 HttpConfiguration config = new HttpConfiguration(); config .EnableSwagger(c => { //Name of the API c.SingleApiVersion("v1", "Fusion Configuration API"); /** * Make sure the project Honeywell.GLSS.Tools.WebAPI have XML document option enabled * and the file Honeywell.GLSS.Tools.WebAPI.xml is available in BaseDirectory. Otherwise * Swagger Ui will not show any documentation. */ c.IncludeXmlComments(string.Format(@"{0}\Honeywell.GLSS.Tools.WebAPI.xml", System.AppDomain.CurrentDomain.BaseDirectory)); c.PrettyPrint(); }) .EnableSwaggerUi(); WebApiConfig.Register(config); DryIocConfig.Configure(config); LoggingConfig.Configure(); app.UseWebApi(config); }
public RootConfig() { Logging = new LoggingConfig(); Proxy = new ProxyConfig(); EndpointDefinition = AWSConfigs._endpointDefinition; Region = AWSConfigs._awsRegion; ProfileName = AWSConfigs._awsProfileName; ProfilesLocation = AWSConfigs._awsAccountsLocation; UseSdkCache = AWSConfigs._useSdkCache; CorrectForClockSkew = true; AWSSection section = AWSConfigs.GetSection <AWSSection>("aws"); Logging.Configure(section.Logging); Proxy.Configure(section.Proxy); ServiceSections = section.ServiceSections; if (section.UseSdkCache.HasValue) { UseSdkCache = section.UseSdkCache.Value; } EndpointDefinition = Choose(EndpointDefinition, section.EndpointDefinition); Region = Choose(Region, section.Region); ProfileName = Choose(ProfileName, section.ProfileName); ProfilesLocation = Choose(ProfilesLocation, section.ProfilesLocation); ApplicationName = Choose(ApplicationName, section.ApplicationName); if (section.CorrectForClockSkew.HasValue) { CorrectForClockSkew = section.CorrectForClockSkew.Value; } }
public RootConfig() { Logging = new LoggingConfig(); Proxy = new ProxyConfig(); EndpointDefinition = AWSConfigs._endpointDefinition; Region = AWSConfigs._awsRegion; ProfileName = AWSConfigs._awsProfileName; ProfilesLocation = AWSConfigs._awsAccountsLocation; UseSdkCache = AWSConfigs._useSdkCache; CorrectForClockSkew = true; #if !WIN_RT && !WINDOWS_PHONE var root = AWSConfigs.GetSection <AWSSection>(_rootAwsSectionName); Logging.Configure(root.Logging); Proxy.Configure(root.Proxy); ServiceSections = root.ServiceSections; if (root.UseSdkCache.HasValue) { UseSdkCache = root.UseSdkCache.Value; } EndpointDefinition = Choose(EndpointDefinition, root.EndpointDefinition); Region = Choose(Region, root.Region); ProfileName = Choose(ProfileName, root.ProfileName); ProfilesLocation = Choose(ProfilesLocation, root.ProfilesLocation); if (root.CorrectForClockSkew.HasValue) { CorrectForClockSkew = root.CorrectForClockSkew.Value; } #endif }
protected void Application_Start() { LoggingConfig.Configure(); AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); //ControllerBuilder.Current.SetControllerFactory(new CustomControllerFactory()); }
public void Application_OnStart(Object sender, EventArgs e) { GlobalConfiguration.Configure(WebApiConfig.Register); LoggingConfig.Configure(); HttpRuntime.Cache.Add("Application", Application, null, Cache.NoAbsoluteExpiration, Cache.NoSlidingExpiration, CacheItemPriority.NotRemovable, null); ConfigureLogging(); ConfigureCache(); CreateRequiredDirectories(); LoadConfiguration(); RegisterBundles(); }
private static async Task RunMainAsync(string[] args) { try { _startupStopwatch = Stopwatch.StartNew(); _hostingEnv = new HostingEnvironment(); var shortEnvName = AppInfo.MapEnvironmentName(_hostingEnv.Environment); var configBuilder = new ConfigurationBuilder() .SetBasePath(Directory.GetCurrentDirectory()) .AddCommandLine(args) .AddJsonFile("config.json") .AddJsonFile($"config.{shortEnvName}.json") .AddJsonFile("app-info.json") .AddEnvironmentVariables(); if (_hostingEnv.IsDockerDev) { configBuilder.AddJsonFile("config.dev-docker.json", optional: true); } var config = configBuilder.Build(); var appInfo = new AppInfo(config); Console.Title = $"Silo - {appInfo.Name}"; var logger = LoggingConfig.Configure(config, appInfo) .CreateLogger(); Log.Logger = logger; _log = logger.ForContext <Program>(); _log.Information("Initializing Silo {appName} ({version}) [{env}]...", appInfo.Name, appInfo.Version, _hostingEnv.Environment); _siloHost = BuildSilo(config, appInfo, logger); AssemblyLoadContext.Default.Unloading += context => { _log.Information("Assembly unloading..."); Task.Run(StopSilo); SiloStopped.WaitOne(); _log.Information("Assembly unloaded complete."); Log.CloseAndFlush(); }; await StartSilo(); } catch (Exception ex) { _log.Error(ex, "An error has occurred while initializing or starting silo."); Log.CloseAndFlush(); } }
/// <summary> /// Startup /// </summary> /// <param name="env"></param> public Startup(IHostingEnvironment env) { var builder = new ConfigurationBuilder() .SetBasePath(env.ContentRootPath) .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true) .AddEnvironmentVariables(); Configuration = builder.Build(); Config = Configuration; Environment = env; LoggingConfig.Configure(Configuration); }
public IServiceProvider ConfigureServices(IServiceCollection services) { // Use this method to add services to the container var logger = LoggingConfig.Configure(Configuration); var auditLogger = new AuditLogger(logger); Log.Logger = logger; Log.Logger.Information("Seed-Tools Stubs configuring services"); services.AddMvc(config => { config.Filters.Add(new ServiceFilterAttribute(typeof(LogAttribute))); }) .AddControllersAsServices() .AddJsonOptions(options => { options.SerializerSettings.DateFormatHandling = DateFormatHandling.IsoDateFormat; options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore; options.SerializerSettings.NullValueHandling = NullValueHandling.Ignore; }); services.AddScoped <LogAttribute>(); var builder = new ContainerBuilder(); builder.RegisterInstance(logger).As <ILogger>(); builder.RegisterInstance(Configuration).As <IConfigurationRoot>(); builder.RegisterInstance(auditLogger).As <IAuditLogger>(); builder.RegisterModule(new LoggingModule(logger, auditLogger)); var mapper = new MapperConfiguration(cfg => { cfg.AddProfiles(GetType().GetTypeInfo().Assembly); }) .CreateMapper(); builder.RegisterInstance(mapper); // // Add any container registrations here // builder.Populate(services); ApplicationContainer = builder.Build(); var _config = ApplicationContainer.Resolve <IConfigurationRoot>(); var x = _config.GetConnectionString("SeedToolsDataStoreConnection"); //GlobalConfiguration.Configuration.UseSqlServerStorage(x); Log.Logger.Information("Seed-Tools Stubs configured services"); var serviceProvider = new AutofacServiceProvider(ApplicationContainer); return(serviceProvider); }
public static void Main(string[] args) { LoggingConfig.Configure("Api"); try { Log.Information("Starting Api"); CreateHostBuilder(args).Build().Run(); } catch (Exception ex) { Log.Fatal(ex, "API Host terminated unexpectedly"); } finally { Log.CloseAndFlush(); } }
public static void Register(HttpConfiguration config) { //var cors = new EnableCorsAttribute("*", "*", "*"); //config.EnableCors(cors); MediaTypeFormattingConfig.Configure(config); RoutingConfig.Configure(config); IoCConfig.Configure(config); TracingConfig.Configure(config, IoCConfig.Container); LoggingConfig.Configure(); ExceptionHandlingConfig.Configure(config); ValidationConfig.Configure(config); LocalizationConfig.Configure(config); //configure authentication config.MessageHandlers.Insert(0, new AuthenticationHandler()); //for gzip compression use: // config.MessageHandlers.Insert(0, new ServerCompressionHandler(new GZipCompressor(), new DeflateCompressor())); }
public void SetUp() { _scope = _resolver.BeginScope(); UserSession = (TestUserSession)_scope.GetService(typeof(IUserSession)); LoggingConfig.Configure(); }
protected virtual ILogger ConfigureLogging(IConfigurationRoot configuration) { return(LoggingConfig.Configure(configuration)); }
private static void ConfigureLogging(string[] args) { LoggingConfig.Configure(args); }
private static void ConfigureLogging() { LoggingConfig.Configure(); }