public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); Configuration = builder.Build(); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { // Setup configuration sources. var builder = new ConfigurationBuilder().AddEnvironmentVariables(); Configuration = builder.Build(); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { Env = env; Env.Initialize(appEnv.ApplicationBasePath, "Development"); Env.Initialize(appEnv.ApplicationBasePath, "Production"); Env.Initialize(appEnv.ApplicationBasePath, "Staging"); #if DEBUG Env.EnvironmentName = "Development"; #else if (appEnv.ApplicationBasePath.ToLower().Contains("staging")) { Env.EnvironmentName = "Staging"; } else { Env.EnvironmentName = "Production"; } #endif // Setup configuration sources. var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); Configuration = builder.Build(); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddJsonFile($"config.{env.EnvironmentName}.json", optional: true); Configuration = builder.Build(); }
public TestApplicationEnvironment(IApplicationEnvironment originalAppEnvironment, string appBasePath, string appName) { _originalAppEnvironment = originalAppEnvironment; _applicationBasePath = appBasePath; _appName = appName; }
public void Configure(IApplicationBuilder app, ILoggerFactory loggerFactory, IApplicationEnvironment env) { var ksi = app.ServerFeatures.Get<IKestrelServerInformation>(); ksi.NoDelay = true; loggerFactory.AddConsole(LogLevel.Error); app.UseKestrelConnectionLogging(); app.Run(async context => { Console.WriteLine("{0} {1}{2}{3}", context.Request.Method, context.Request.PathBase, context.Request.Path, context.Request.QueryString); Console.WriteLine($"Method: {context.Request.Method}"); Console.WriteLine($"PathBase: {context.Request.PathBase}"); Console.WriteLine($"Path: {context.Request.Path}"); Console.WriteLine($"QueryString: {context.Request.QueryString}"); var connectionFeature = context.Connection; Console.WriteLine($"Peer: {connectionFeature.RemoteIpAddress?.ToString()} {connectionFeature.RemotePort}"); Console.WriteLine($"Sock: {connectionFeature.LocalIpAddress?.ToString()} {connectionFeature.LocalPort}"); var content = $"Hello world!{Environment.NewLine}Received '{Args}' from command line."; context.Response.ContentLength = content.Length; context.Response.ContentType = "text/plain"; await context.Response.WriteAsync(content); }); }
public Startup(IApplicationEnvironment appEnv, IHostingEnvironment env) { _configuration = new ConfigurationBuilder(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables("BritishProverbs-") .Build(); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { Configuration = new ConfigurationBuilder() .AddJsonFile(ConfigFilename) .AddEnvironmentVariables() .Build(); }
public ProviderServices(IApplicationEnvironment env) { var configuration = new ConfigurationBuilder() .BuildConfiguration(env); _serviceProvider = new ServiceCollection() .AddLogging() .AddOptions() .Configure<MailConfiguration>(configuration) .Configure<TestOptions>(configuration) .AddSingleton<TestConfiguration>() .AddInstance(configuration) .AddProceesProviderServices() .AddTransient<IModifiedCodeTestsFinder, ModifiedCodeTestsFinder>() .AddTransient<IDnxTestRunner, DnxTestRunner>() .AddTransient<ITestRunner, TestRunner>() .AddTransient<IMailServiceFactory, MailServiceFactory>() .AddInstance(env) .BuildServiceProvider(); _serviceProvider.GetService<ILoggerFactory>().AddConsole(LogLevel.Information); }
public Startup(IApplicationEnvironment appEnv) { _configurationRoot = new ConfigurationBuilder() .SetBasePath(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .Build(); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { _basePath = appEnv.ApplicationBasePath; Configuration = new ConfigurationBuilder() .AddJsonFile(_basePath + "/App_Data/Development.json") .Build(); }
public static void Register(CommandLineApplication cmdApp, IApplicationEnvironment appEnvironment) { cmdApp.Command("scan", c => { c.Description = "Scan a directory tree and produce a JSON array of source units"; var repoName = c.Option ("--repo <REPOSITORY_URL>", "The URI of the repository that contains the directory tree being scanned", CommandOptionType.SingleValue); var subdir = c.Option ("--subdir <SUBDIR_PATH>", "The path of the current directory (in which the scanner is run), relative to the root directory of the repository being scanned", CommandOptionType.SingleValue); c.HelpOption("-?|-h|--help"); c.OnExecute(() => { var repository = repoName.Value(); var dir = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), subdir.Value())); //Console.WriteLine($"Repository: {repository}"); //Console.WriteLine($"Directory: {dir}"); var sourceUnits = new List<SourceUnit>(); foreach(var proj in Scan(dir)) { //Console.WriteLine($"Found project: {proj.Name} ({proj.Version}, {proj.CompilerServices})"); sourceUnits.Add(SourceUnit.FromProject(proj, dir)); } //Console.Error.Write($"Current dir: {Environment.CurrentDirectory}\n"); Console.WriteLine(JsonConvert.SerializeObject(sourceUnits, Formatting.Indented)); return 0; }); }); }
public Startup(IApplicationEnvironment env) { var builder = new ConfigurationBuilder() .AddJsonFile("config.json") .AddEnvironmentVariables(); Configuration = builder.Build(); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { var configPath = Path.Combine(appEnv.ApplicationBasePath, "..", ".."); Configuration = new Configuration(configPath).AddJsonFile("config.json"). AddEnvironmentVariables("SmsPrize_"); }
public static void Register(CommandLineApplication cmdApp, IApplicationEnvironment appEnv, IRuntimeEnvironment runtimeEnv) { if (runtimeEnv.OperatingSystem == "Windows") { _dnuPath = new Lazy<string>(FindDnuWindows); } else { _dnuPath = new Lazy<string>(FindDnuNix); } cmdApp.Command("depresolve", c => { c.Description = "Perform a combination of parsing, static analysis, semantic analysis, and type inference"; c.HelpOption("-?|-h|--help"); c.OnExecute(async () => { //System.Diagnostics.Debugger.Launch(); var jsonIn = await Console.In.ReadToEndAsync(); var sourceUnit = JsonConvert.DeserializeObject<SourceUnit>(jsonIn); var dir = Path.Combine(Directory.GetCurrentDirectory(), sourceUnit.Dir); var deps = await DepResolve(dir); var result = new List<Resolution>(); foreach(var dep in deps) { result.Add(Resolution.FromLibrary(dep)); } Console.WriteLine(JsonConvert.SerializeObject(result, Formatting.Indented)); return 0; }); }); }
public ApplicationSettings(IApplicationEnvironment appEnv, IHostingEnvironment env) { _appEnv = appEnv; _env = env; BasePath = Path.GetFullPath(Path.Combine(_appEnv.ApplicationBasePath, "../")); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnvironment) { _appEnvironment = appEnvironment; _hostingEnvironment = env; var RollingPath = Path.Combine(appEnvironment.ApplicationBasePath, "logs/myapp-{Date}.txt"); Log.Logger = new LoggerConfiguration() .WriteTo.RollingFile(RollingPath) .CreateLogger(); Log.Information("Ah, there you are!"); // Set up configuration sources. var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddJsonFile("appsettings-filters.json") .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); if (env.IsDevelopment()) { // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709 builder.AddUserSecrets(); } builder.AddEnvironmentVariables(); Configuration = builder.Build(); // Initialize the global configuration static GlobalConfigurationRoot.Configuration = Configuration; }
public Startup(IHostingEnvironment hostingEnvironment, IApplicationEnvironment applicationEnvironment) { Configuration = new ConfigurationBuilder() .SetBasePath(applicationEnvironment.ApplicationBasePath) .AddJsonFile("config.json") .Build(); }
public Startup(IApplicationEnvironment environment) { Configuration = new ConfigurationBuilder(environment.ApplicationBasePath) .AddJsonFile("config.json") .Build(); }
public Startup( IHostingEnvironment env, IApplicationEnvironment appEnv) { _env = env; // Setup configuration sources. var builder = new ConfigurationBuilder() .SetBasePath(appEnv.ApplicationBasePath) // standard config file .AddJsonFile("config.json") // environment specific config.<environment>.json file .AddJsonFile($"config.{env.EnvironmentName}.json", true /* override if exists */) // standard Windows environment variables .AddEnvironmentVariables(); if (env.IsDevelopment()) { // this one adds not using directive to keep it secret, only a dnx reference // the focus is not on Secrets but on User, so these are User specific settings // we can also make it available only for developers builder.AddUserSecrets(); } Configuration = builder.Build(); }
/// <summary> /// Publishes the markdown as a file. /// </summary> /// <param name="markdown">Content in Markdown format.</param> /// <param name="env"><see cref="IApplicationEnvironment"/> instance.</param> /// <returns>Returns the Markdown file path in a virtual path format.</returns> public async Task<string> PublishMarkdownAsync(string markdown, IApplicationEnvironment env) { if (string.IsNullOrWhiteSpace(markdown)) { throw new ArgumentNullException(nameof(markdown)); } if (env == null) { throw new ArgumentNullException(nameof(env)); } var filename = "markdown.md"; var markdownpath = $"{this._settings.MarkdownPath}/{filename}"; var filepath = this._fileHelper.GetDirectory(env, this._settings.MarkdownPath); filepath = Path.Combine(new[] { filepath, filename }); var written = await this._fileHelper.WriteAsync(filepath, markdown).ConfigureAwait(false); if (!written) { throw new PublishFailedException("Markdown not published"); } return markdownpath; }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { //Setting up configuration builder var builder = new ConfigurationBuilder() .SetBasePath(appEnv.ApplicationBasePath) .AddEnvironmentVariables(); if (!env.IsProduction()) { builder.AddUserSecrets(); } else { } Configuration = builder.Build(); //Setting up configuration if (!env.IsProduction()) { var confConnectString = Configuration.GetSection("Data:DefaultConnection:ConnectionString"); confConnectString.Value = @"Server=(localdb)\mssqllocaldb;Database=GetHabitsAspNet5;Trusted_Connection=True;"; var identityConnection = Configuration.GetSection("Data:IdentityConnection:ConnectionString"); identityConnection.Value = @"Server=(localdb)\mssqllocaldb;Database=GetHabitsIdentity;Trusted_Connection=True;"; } else { } }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { // Setup configuration sources. var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); if (env.IsEnvironment("Development")) { // This reads the configuration keys from the secret store. // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709 builder.AddUserSecrets(); } // this file name is ignored by gitignore // so you can create it and use on your local dev machine // remember last config source added wins if it has the same settings builder.AddJsonFile("appsettings.local.overrides.json", optional: true); // most common use of environment variables would be in azure hosting // since it is added last anything in env vars would trump the same setting in previous config sources // so no risk of messing up settings if deploying a new version to azure builder.AddEnvironmentVariables(); Configuration = builder.Build(); //env.MapPath appBasePath = appEnv.ApplicationBasePath; }
public CompilationEngineContext(IApplicationEnvironment applicationEnvironment, IAssemblyLoadContext defaultLoadContext, CompilationCache cache) : this(applicationEnvironment, defaultLoadContext, cache, NoopWatcher.Instance, new ProjectGraphProvider()) { }
public BundleService(IApplicationEnvironment appEnvironment, ILogger<BundleService> logger) { _appEnvironment = appEnvironment; _logger = logger; _logger.LogDebug("Application base path: \"{0}\"", _appEnvironment.ApplicationBasePath); _logger.LogInformation("BundleService created"); }
public HtmlEngineFactory(IHttpContextAccessor httpContextAccessor, ICompositeViewEngine viewEngine, ITempDataProvider tempDataProvider, IApplicationEnvironment hostingEnvironment) { _httpContextAccessor = httpContextAccessor; _viewEngine = viewEngine; _tempDataProvider = tempDataProvider; _hostingEnvironment = hostingEnvironment; }
public void Configure(IApplicationBuilder app, IApplicationEnvironment env) { app.UseIISPlatformHandler(); app.UseDeveloperExceptionPage(); var certFile = env.ApplicationBasePath + "\\idsrv3test.pfx"; app.Map("/identity", idsrvApp => { idsrvApp.UseIdentityServer(new IdentityServerOptions { SiteName = "Embedded IdentityServer", SigningCertificate = new X509Certificate2(certFile, "idsrv3test"), Factory = new IdentityServerServiceFactory() .UseInMemoryUsers(Users.Get()) .UseInMemoryClients(Clients.Get()) .UseInMemoryScopes(Scopes.Get()), AuthenticationOptions = new IdentityServer3.Core.Configuration.AuthenticationOptions { EnableLocalLogin = false, IdentityProviders = ConfigureIdentityProviders, SignInMessageThreshold = 5 } }); }); app.UseCors("mypolicy"); app.UseMvc(); }
/// <summary> /// Dependency-injected application settings which are then passed on to other components. /// </summary> public TransitApiController(IApplicationEnvironment appEnv) { _repository = new MemoryTransitRepository(appEnv.ApplicationBasePath); _client = new TransitClient(); _getCurrentTime = () => TimeZoneInfo.ConvertTime(DateTimeOffset.Now, TimeZoneInfo.FindSystemTimeZoneById("Pacific Standard Time")); }
public MockAuthorizationPipeline(IApplicationEnvironment environment) { _environment = environment; Login = OnLogin; Consent = OnConsent; Error = OnError; }
/// <summary> /// Parses the <see cref="ICompilerOptions"/> for the current executing application and returns a /// <see cref="CompilationSettings"/> used for Roslyn compilation. /// </summary> /// <param name="compilerOptionsProvider"> /// A <see cref="ICompilerOptionsProvider"/> that reads compiler options. /// </param> /// <param name="applicationEnvironment"> /// The <see cref="IApplicationEnvironment"/> for the executing application. /// </param> /// <param name="configuration"> /// The configuration name to use for compilation. /// </param> /// <returns>The <see cref="CompilationSettings"/> for the current application.</returns> public static CompilationSettings GetCompilationSettings( this ICompilerOptionsProvider compilerOptionsProvider, IApplicationEnvironment applicationEnvironment, string configuration) { if (compilerOptionsProvider == null) { throw new ArgumentNullException(nameof(compilerOptionsProvider)); } if (applicationEnvironment == null) { throw new ArgumentNullException(nameof(applicationEnvironment)); } if (string.IsNullOrEmpty(configuration)) { throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(configuration)); } return compilerOptionsProvider.GetCompilerOptions( applicationEnvironment.ApplicationName, applicationEnvironment.RuntimeFramework, configuration) .ToCompilationSettings(applicationEnvironment.RuntimeFramework, applicationEnvironment.ApplicationBasePath); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); if (env.IsDevelopment()) { // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709 builder.AddUserSecrets(); } builder.AddEnvironmentVariables(); Configuration = builder.Build(); XmlConfigurator.Configure(new FileInfo(Path.Combine(appEnv.ApplicationBasePath, "log4net.xml"))); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { // Setup configuration sources. var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddJsonFile($"config.{env.EnvironmentName}.json", optional: true); if (env.IsDevelopment()) { // This reads the configuration keys from the secret store. // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709 builder.AddUserSecrets(); } builder.AddEnvironmentVariables(); Configuration = builder.Build(); }
public ControllerGenerator( [NotNull] ILibraryManager libraryManager, [NotNull] IApplicationEnvironment environment, [NotNull] IModelTypesLocator modelTypesLocator, [NotNull] IEntityFrameworkService entityFrameworkService, [NotNull] ICodeGeneratorActionsService codeGeneratorActionsService, [NotNull] IServiceProvider serviceProvider, [NotNull] ILogger logger) { _libraryManager = libraryManager; _applicationEnvironment = environment; _codeGeneratorActionsService = codeGeneratorActionsService; _modelTypesLocator = modelTypesLocator; _entityFrameworkService = entityFrameworkService; _serviceProvider = serviceProvider; _logger = logger; }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env, IApplicationEnvironment appEnvironment) { app.UseIISPlatformHandler(); if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { } app.UseRuntimeInfoPage("/info"); app.UseFileServer(); app.UseMvc(ConfigureRoutes); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { // Set up configuration sources. var builder = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddJsonFile($"appsettings.{env.EnvironmentName}.json", optional: true); if (env.IsDevelopment()) { // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709 builder.AddUserSecrets(); } builder.AddEnvironmentVariables(); Configuration = builder.Build(); Configuration["Data:DefaultConnection:ConnectionString"] = $@"Data Source={appEnv.ApplicationBasePath}/WindtalkerVnext.db"; }
public FSharpCompiler( ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedDependencyProvider, IAssemblyLoadContextFactory loadContextFactory, IFileWatcher watcher, IApplicationEnvironment environment, IServiceProvider services) { _cache = cache; _cacheContextAccessor = cacheContextAccessor; _namedDependencyProvider = namedDependencyProvider; _loadContextFactory = loadContextFactory; _watcher = watcher; _environment = environment; _services = services; }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { try { var builder = new ConfigurationBuilder() .SetBasePath(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); Configuration = builder.Build(); } catch (FormatException e) { Debug.WriteLine($"Logged exception: {e.Message}"); throw; } }
public SiteThemeListBuilder( IApplicationEnvironment appEnvironment, IHttpContextAccessor contextAccessor ) { if (appEnvironment == null) { throw new ArgumentNullException(nameof(appEnvironment)); } if (contextAccessor == null) { throw new ArgumentNullException(nameof(contextAccessor)); } appBasePath = appEnvironment.ApplicationBasePath; this.contextAccessor = contextAccessor; }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv, ILoggerFactory loggerFactory) { if (env.IsProduction()) { loggerFactory.MinimumLevel = LogLevel.Error; } else if (env.IsStaging()) { loggerFactory.MinimumLevel = LogLevel.Warning; } else { loggerFactory.MinimumLevel = LogLevel.Verbose; loggerFactory.AddConsole((n, l) => l >= loggerFactory.MinimumLevel); } Logger = loggerFactory.CreateLogger(this.GetType().Namespace.ToString()); var selfFullName = this.GetType().FullName; if (selfFullName.LastIndexOf('.') > 0) { ProductNs = selfFullName .Substring(0, selfFullName.LastIndexOf('.')) .Replace('.', ':'); } Logger.LogVerbose($"ProductNs = { ProductNs }"); var builder = new ConfigurationBuilder() .SetBasePath(appEnv.ApplicationBasePath) .AddJsonFile(CONFIG_FILE_GLOBAL) .AddJsonFile(CONFIG_FILE_ENVIRONMENT.Replace("{ENV}", env.EnvironmentName), true); if (env.IsDevelopment()) { Logger.LogVerbose("Development environment detected."); builder.AddUserSecrets(); } builder.AddEnvironmentVariables(); Configuration = builder.Build(); }
public Startup(IHostingEnvironment env, IApplicationEnvironment app) { var path = app.ApplicationBasePath; var configuration = new ConfigurationBuilder(path) .AddJsonFile($"{path}\\Config.json") .AddJsonFile($"{path}\\config.{env.EnvironmentName}.json", optional: true); if (env.IsEnvironment("Development")) { // This reads the configuration keys from the secret store. // For more details on using the user secret store see http://go.microsoft.com/fwlink/?LinkID=532709 //configuration.AddUserSecrets(); } configuration.AddEnvironmentVariables(); Configuration = configuration.Build(); startUpManager = new DependencyInjection.StartupManager(Configuration); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IApplicationEnvironment env, ILoggerFactory loggerFactory) { loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddDebug(); app.UseIISPlatformHandler(); app.UseDefaultFiles(); app.UseStaticFiles(); var nodePath = Path.Combine(env.ApplicationBasePath, "node_modules"); app.UseFileServer(new FileServerOptions() { FileProvider = new PhysicalFileProvider(nodePath), RequestPath = "/node_modules", EnableDirectoryBrowsing = true }); app.UseMvc(); }
public RoslynProjectCompiler( ICache cache, ICacheContextAccessor cacheContextAccessor, INamedCacheDependencyProvider namedCacheProvider, IAssemblyLoadContext loadContext, IFileWatcher watcher, IApplicationEnvironment environment, IServiceProvider services) { _compiler = new RoslynCompiler( cache, cacheContextAccessor, namedCacheProvider, loadContext, watcher, environment, services); }
/// <summary> /// Initalizes a new instance of the <see cref="RoslynCompilationService"/> class. /// </summary> /// <param name="environment">The environment for the executing application.</param> /// <param name="loaderAccessor"> /// The accessor for the <see cref="IAssemblyLoadContext"/> used to load compiled assemblies. /// </param> /// <param name="libraryManager">The library manager that provides export and reference information.</param> /// <param name="compilerOptionsProvider"> /// The <see cref="ICompilerOptionsProvider"/> that provides Roslyn compilation settings. /// </param> /// <param name="host">The <see cref="IMvcRazorHost"/> that was used to generate the code.</param> public RoslynCompilationService( IApplicationEnvironment environment, ILibraryExporter libraryExporter, ICompilerOptionsProvider compilerOptionsProvider, IMvcRazorHost host, IOptions <RazorViewEngineOptions> optionsAccessor) { _environment = environment; _libraryExporter = libraryExporter; _applicationReferences = new Lazy <List <MetadataReference> >(GetApplicationReferences); _compilerOptionsProvider = compilerOptionsProvider; _fileProvider = optionsAccessor.Value.FileProvider; _classPrefix = host.MainClassNamePrefix; #if DOTNET5_4 _razorLoadContext = new RazorLoadContext(); #endif }
public Program([NotNull] IServiceProvider serviceProvider, [NotNull] IApplicationEnvironment appEnv, [NotNull] ILibraryManager libraryManager) { Check.NotNull(serviceProvider, nameof(serviceProvider)); Check.NotNull(appEnv, nameof(appEnv)); Check.NotNull(libraryManager, nameof(libraryManager)); _projectDir = appEnv.ApplicationBasePath; _rootNamespace = appEnv.ApplicationName; var loggerProvider = new LoggerProvider(name => new ConsoleCommandLogger(name, verbose: true)); var assemblyName = new AssemblyName(appEnv.ApplicationName); var assembly = Assembly.Load(assemblyName); _migrationTool = new MigrationTool(loggerProvider, assembly); _databaseTool = new DatabaseTool(serviceProvider, loggerProvider); _libraryManager = libraryManager; }
public SystemInfoManager( IRuntimeEnvironment runtimeEnvironment, IHostingEnvironment hostingEnvironment, IApplicationEnvironment appEnvironment, IVersionProviderFactory versionProviderFactory, IDb database, ILogRepository logRepository) { runtimeInfo = runtimeEnvironment; appInfo = appEnvironment; hostingInfo = hostingEnvironment; db = database; logRepo = logRepository; versionProviders = versionProviderFactory; cloudscribeVersionProvider = versionProviders.Get("cloudscribe-core"); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { string configServiceUrl = "http://aspnet5-bookportal-configuration.azurewebsites.net/"; var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath); builder.AddJsonFile("config.json"); builder.AddConfigurationService(configServiceUrl, "Shared"); builder.AddConfigurationService(configServiceUrl, "BookPortalWeb"); if (env.IsDevelopment()) { // This will push telemetry data through Application Insights pipeline faster, allowing you to view results immediately. builder.AddApplicationInsightsSettings(developerMode: true); } Configuration = builder.Build(); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { _env = env; var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddJsonFile($"config.{env.EnvironmentName}.json", optional: true); if (_env.IsDevelopment()) { builder.AddUserSecrets(); builder.AddApplicationInsightsSettings(developerMode: true); } builder.AddEnvironmentVariables(); Configuration = builder.Build(); }
private static string GetXmlPath(IApplicationEnvironment appEnv) { var assembly = typeof(Startup).GetTypeInfo().Assembly; var assemblyName = assembly.GetName().Name; var path = $@"{appEnv.ApplicationBasePath}\{assemblyName}.xml"; if (File.Exists(path)) { return(path); } var config = appEnv.Configuration; var runtime = $"{appEnv.RuntimeFramework.Identifier.ToLower()}{appEnv.RuntimeFramework.Version.ToString().Replace(".", string.Empty)}"; path = $@"{appEnv.ApplicationBasePath}\..\..\artifacts\bin\{assemblyName}\{config}\{runtime}\{assemblyName}.xml"; return(path); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { var builder = new ConfigurationBuilder() .SetBasePath(appEnv.ApplicationBasePath); if (env.IsDevelopment()) { builder.AddJsonFile("appsettings.json").AddJsonFile("privatesettings.json"); } else { builder.AddJsonFile("appsettings.json", optional: true); } builder.AddUserSecrets(); builder.AddEnvironmentVariables(); this.Configuration = builder.Build(); }
public void ConfigureWithVirtualDirectory( IApplicationBuilder app, IHostingEnvironment env, IApplicationEnvironment appEnv, ILoggerFactory loggerFactory) { appEnv.SetData("Environment", Configuration["Environment"]); // if (env.IsDevelopment()) // { app.UseDeveloperExceptionPage(); // } // else // { // //app.UseExceptionHandler("/Home/Error"); // } app.UseIISPlatformHandler(); app.UseStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller=Default}/{action=Index}/{id?}"); }); // this will serve up wwwroot app.UseFileServer(); // this will serve up node_modules // var provider = new PhysicalFileProvider( // Path.Combine(appEnv.ApplicationBasePath, "node_modules") // ); // var options = new FileServerOptions(); // options.RequestPath = "/node_modules"; // options.StaticFileOptions.FileProvider = provider; // options.EnableDirectoryBrowsing = true; // app.UseFileServer(options); loggerFactory.MinimumLevel = LogLevel.Warning; // Set the framework logging level loggerFactory.AddSerilog(); // To tie into the framework logging and write all of its events }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { // Set up configuration sources var builder = new ConfigurationBuilder() .SetBasePath(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); if (env.IsDevelopment()) { builder.AddUserSecrets(); } Configuration = builder.Build(); // Increase default outgoing connection limit to a larger number to allow // more parallel requests to go out to GitHub. ServicePointManager.DefaultConnectionLimit = 10; }
public CompilationEngineContext(IApplicationEnvironment applicationEnvironment, IAssemblyLoadContext defaultLoadContext, CompilationCache cache, IFileWatcher fileWatcher, IProjectGraphProvider projectGraphProvider) { ApplicationEnvironment = applicationEnvironment; DefaultLoadContext = defaultLoadContext; ProjectGraphProvider = projectGraphProvider; CompilationCache = cache; FileWatcher = fileWatcher; // Register compiler services AddCompilationService(typeof(IFileWatcher), FileWatcher); AddCompilationService(typeof(IApplicationEnvironment), ApplicationEnvironment); AddCompilationService(typeof(ICache), CompilationCache.Cache); AddCompilationService(typeof(ICacheContextAccessor), CompilationCache.CacheContextAccessor); AddCompilationService(typeof(INamedCacheDependencyProvider), CompilationCache.NamedCacheDependencyProvider); }
public Startup(IApplicationEnvironment appEnv) { //Sample Dictionary object to use in in memory collection. This could be computed or fetched dynamically Dictionary <string, string> someConfigDictionary = new Dictionary <string, string>(); someConfigDictionary.Add("key1", "value1"); someConfigDictionary.Add("key2", "value2"); someConfigDictionary.Add("key3", "value3"); //Create the configuratonBuilder object var configurationBuilder = new ConfigurationBuilder() .SetBasePath(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables() .AddInMemoryCollection(someConfigDictionary); //call the .Build and set the ConfigurationRoot object ConfigurationProvider = configurationBuilder.Build(); }
public DefaultAssetCache( ThemeSettings themeSettings, IApplicationEnvironment env, IThemeFileResolver themeFileResolver, IThemeContext themeContext, IThemeRegistry themeRegistry, ICommonServices services) { _themeSettings = themeSettings; _isEnabled = _themeSettings.AssetCachingEnabled == 2 || (_themeSettings.AssetCachingEnabled == 0 && !HttpContext.Current.IsDebuggingEnabled); _env = env; _themeContext = themeContext; _themeFileResolver = themeFileResolver; _themeRegistry = themeRegistry; _services = services; Logger = NullLogger.Instance; }
/// <summary> /// Parses the <see cref="ICompilerOptions"/> for the current executing application and returns a /// <see cref="CompilationSettings"/> used for Roslyn compilation. /// </summary> /// <param name="compilerOptionsProvider"> /// A <see cref="ICompilerOptionsProvider"/> that reads compiler options. /// </param> /// <param name="applicationEnvironment"> /// The <see cref="IApplicationEnvironment"/> for the executing application. /// </param> /// <returns>The <see cref="CompilationSettings"/> for the current application.</returns> public static CompilationSettings GetCompilationSettings( this ICompilerOptionsProvider compilerOptionsProvider, IApplicationEnvironment applicationEnvironment) { if (compilerOptionsProvider == null) { throw new ArgumentNullException(nameof(compilerOptionsProvider)); } if (applicationEnvironment == null) { throw new ArgumentNullException(nameof(applicationEnvironment)); } return(compilerOptionsProvider.GetCompilerOptions(applicationEnvironment.ApplicationName, applicationEnvironment.RuntimeFramework, applicationEnvironment.Configuration) .ToCompilationSettings(applicationEnvironment.RuntimeFramework)); }
public Startup(IApplicationEnvironment appEnv, ILoggerFactory loggerFactory, IHostingEnvironment hostEnv) { _appEnv = appEnv; loggerFactory.MinimumLevel = LogLevel.Debug; loggerFactory.AddConsole(loggerFactory.MinimumLevel); var runtimeConfig = new ConfigurationBuilder() .AddEnvironmentVariables() // currently not accessible from command line .Build(); _options = new Options(); runtimeConfig.Bind(_options); _queueConfig = new ConfigurationBuilder(_appEnv.ApplicationBasePath) .AddJsonFile("queues.json") .Build() .GetSection(_options.QueueType); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv, ILoggerFactory loggerFactory) { loggerFactory.MinimumLevel = LogLevel.Information; loggerFactory.AddConsole(); var apiConfig = ConfigReader.Get(appEnv.ApplicationBasePath + @"\serviceConfigSource.json"); var builder = new ConfigurationBuilder(appEnv.ApplicationBasePath) .AddJsonFile("config.json") .AddEnvironmentVariables(); builder.Add(new ServiceConfigurationSource( apiConfig.ApiKey, apiConfig.UriFormat, "test", "hello")); Configuration = builder.Build(); }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { _appEnv = appEnv; Services.DtoMapper.Setup(); Framework.Mails.MailTemplateStore.Instance.Add(GetTemplate("Activation")); Framework.Mails.MailTemplateStore.Instance.Add(GetTemplate("ResetPassword")); ServicePointManager.DefaultConnectionLimit = 100; ServicePointManager.Expect100Continue = false; ServicePointManager.UseNagleAlgorithm = false; ApiExceptionRegistry.AddItem(typeof(ActivationRequiredException), HttpStatusCode.Forbidden); ApiExceptionRegistry.AddItem(typeof(ActivationException), HttpStatusCode.Forbidden); ApiExceptionRegistry.AddItem(typeof(ConfirmationException), HttpStatusCode.Forbidden); Framework.Logging.NLogLogger.SetConfiguration( System.IO.Path.Combine(System.IO.Path.Combine(appEnv.ApplicationBasePath, "config"), "web.nlog")); }
public Program(IServiceProvider hostServices, IApplicationEnvironment environment, IRuntimeEnvironment runtimeEnv) { _hostServices = hostServices; _environment = environment; _runtimeEnv = runtimeEnv; #if DNX451 Thread.GetDomain().SetData(".appDomain", this); ServicePointManager.DefaultConnectionLimit = 1024; // Work around a Mono issue that makes restore unbearably slow, // due to some form of contention when requests are processed // concurrently. Restoring sequentially is *much* faster in this case. if (RuntimeEnvironmentHelper.IsMono) { ServicePointManager.DefaultConnectionLimit = 1; } #endif }
public Startup(IHostingEnvironment env, IApplicationEnvironment appEnv) { // ------------------------------------------------------------------------------------ // Setup configuration sources. // I discovered ConfigurationBuilder at this link. // https://github.com/aspnet/Announcements/issues/25 // Excellent article on configuration. // http://trondjun.com/custom-configuration-mvc-6-and-asp-net-5-microsoft-framework-configuration/ // ------------------------------------------------------------------------------------ var configurationBuilder = new ConfigurationBuilder(appEnv.ApplicationBasePath) .AddJsonFile($"config.{appEnv.Configuration}.json", optional: true) .AddEnvironmentVariables(); Configuration = configurationBuilder.Build(); // Just testing var connectionString = Configuration.Get("connections:testEnv"); }