private static void AddStartupEnvironmentsWithServices(string solutionDirectory, ApiTemplate template) { // add a development environment by default for local work if none exists if (template.Environments.Where(e => e.EnvironmentName == "Development").Count() == 0) { template.Environments.Add(new ApiEnvironment { EnvironmentName = "Development", ProfileName = $"{template.SolutionName} (Development)" }); } foreach (var env in template.Environments) { // default startup is already built in cleanup phase if (env.EnvironmentName != "Startup") { StartupBuilder.CreateStartup(solutionDirectory, env.EnvironmentName, template); } AppSettingsBuilder.CreateAppSettings(solutionDirectory, env, template.DbContext.DatabaseName, template); LaunchSettingsModifier.AddProfile(solutionDirectory, env); //services if (!template.SwaggerConfig.IsSameOrEqualTo(new SwaggerConfig())) { SwaggerBuilder.RegisterSwaggerInStartup(solutionDirectory, env); } } }
public static void AddStartupEnvironmentsWithServices( string solutionDirectory, string projectName, string dbName, List <ApiEnvironment> environments, SwaggerConfig swaggerConfig, int port, bool useJwtAuth, string projectBaseName, IFileSystem fileSystem) { AppSettingsBuilder.CreateWebApiAppSettings(solutionDirectory, dbName, projectBaseName); if (environments.Where(e => e.EnvironmentName == "Development").Count() == 0) { environments.Add(new ApiEnvironment { EnvironmentName = "Development", ProfileName = $"{projectName} (Development)" }); } foreach (var env in environments) { WebApiLaunchSettingsModifier.AddProfile(solutionDirectory, env, port, projectBaseName); } if (!swaggerConfig.IsSameOrEqualTo(new SwaggerConfig())) { SwaggerBuilder.RegisterSwaggerInStartup(solutionDirectory, projectBaseName); } }
public static void AddStartupEnvironmentsWithServices( string solutionDirectory, string solutionName, string dbName, List <ApiEnvironment> environments, SwaggerConfig swaggerConfig, int port, bool useJwtAuth, string projectBaseName = "") { // add a development environment by default for local work if none exists if (environments.Where(e => e.EnvironmentName == "Development").Count() == 0) { environments.Add(new ApiEnvironment { EnvironmentName = "Development", ProfileName = $"{solutionName} (Development)" }); } if (environments.Where(e => e.EnvironmentName == "Production").Count() == 0) { environments.Add(new ApiEnvironment { EnvironmentName = "Production", ProfileName = $"{solutionName} (Production)" }); } var sortedEnvironments = environments.OrderBy(e => e.EnvironmentName == "Development" ? 1 : 0).ToList(); // sets dev as default profile foreach (var env in sortedEnvironments) { // default startup is already built in cleanup phase if (env.EnvironmentName != "Production") { StartupBuilder.CreateWebApiStartup(solutionDirectory, env.EnvironmentName, useJwtAuth, projectBaseName); } WebApiAppSettingsBuilder.CreateAppSettings(solutionDirectory, env, dbName, projectBaseName); WebApiLaunchSettingsModifier.AddProfile(solutionDirectory, env, port, projectBaseName); //services if (!swaggerConfig.IsSameOrEqualTo(new SwaggerConfig())) { SwaggerBuilder.RegisterSwaggerInStartup(solutionDirectory, env, projectBaseName); } } // add an integration testing env to make sure that an in memory database is used var functionalEnv = new ApiEnvironment() { EnvironmentName = "FunctionalTesting" }; WebApiAppSettingsBuilder.CreateAppSettings(solutionDirectory, functionalEnv, "", projectBaseName); }