public void ThrowsExceptionWhenNoArgsArePassed() { var args = new string[0]; var ex = Assert.Throws <ValidationException>(() => ConfigurationBootstrapper.Bootstrap <AppSettings>(args)); ex.Message.ShouldBe("At least one of CurrentBranch or FullSemVer must be provided."); }
public void WhenPassingOutputFormats(string[] args, string[] expectedOutputFormats) { var fullArgs = new [] { "--CurrentBranch", "main" }.Concat(args).ToArray(); var(appSettings, _) = ConfigurationBootstrapper.Bootstrap <AppSettings>(fullArgs); appSettings.OutputFormats.ShouldBeEquivalentTo(expectedOutputFormats); }
public Startup(IConfiguration configuration) { Configuration = configuration; _emailConfig = Configuration.GetSection("Email").Get <EmailConfiguration>(); _appConfig = Configuration.GetSection("Application").Get <ApplicationConfiguration>(); _identityConfig = Configuration.GetSection("IdentityProvider").Get <ExampleIdentityConfiguration>(); _bootstrapper = new ConfigurationBootstrapper(_container); }
static void Main(string[] args) { var(appSettings, configuration) = ConfigurationBootstrapper.Bootstrap <AppSettings>(args); var runner = new OctoVersionRunner(appSettings, configuration); runner.Run(out _); }
public void WhenPassingFullSemVer() { var args = new[] { "--FullSemVer", "1.0.0" }; var(appSettings, _) = ConfigurationBootstrapper.Bootstrap <AppSettings>(args); appSettings.FullSemVer.ShouldBe("1.0.0"); appSettings.NonPreReleaseTags.ShouldBeEquivalentTo(new [] { "main", "master" }); //defaults should be applied appSettings.OutputFormats.ShouldBeEquivalentTo(new [] { "Console" }); //defaults should be applied }
public void WhenPassingCurrentBranch() { var args = new[] { "--CurrentBranch", "main" }; var(appSettings, _) = ConfigurationBootstrapper.Bootstrap <AppSettings>(args); appSettings.CurrentBranch.ShouldBe("main"); appSettings.NonPreReleaseTags.ShouldBeEquivalentTo(new [] { "main", "master" }); //defaults should be applied appSettings.OutputFormats.ShouldBeEquivalentTo(new [] { "Console" }); //defaults should be applied }
public static void Register(IMutableDependencyResolver services, IReadonlyDependencyResolver resolver, DataAccessConfiguration dataAccessConfig) { EnvironmentServicesBootstrapper.RegisterEnvironmentServices(services, resolver); ConfigurationBootstrapper.RegisterConfiguration(services, resolver, dataAccessConfig); LoggingBootstrapper.RegisterLogging(services, resolver); AvaloniaServicesBootstrapper.RegisterAvaloniaServices(services); FileSystemWatcherServicesBootstrapper.RegisterFileSystemWatcherServices(services, resolver); DataAccessBootstrapper.RegisterDataAccess(services, resolver); ServicesBootstrapper.RegisterServices(services, resolver); ViewModelsBootstrapper.RegisterViewModels(services, resolver); }
/// <summary> /// Bootstrapping entry /// </summary> /// <param name="backgroundBootstrapConfiguration"></param> /// <param name="scanAssemblies"></param> /// <returns></returns> public static IServiceContainer BootstrapHelper(this IBackgroundApplicationBootstrapConfiguration backgroundBootstrapConfiguration, params Assembly[] scanAssemblies) { if (scanAssemblies == null) { StackTrace stackTrace = new StackTrace(); // TODO: workaround for tests var assembly = stackTrace.GetFrame(1).GetMethod().DeclaringType.Assembly; scanAssemblies = new Assembly[] { assembly }; } ConfigurationBootstrapper configurationBootstrapper = new ConfigurationBootstrapper(); configurationBootstrapper.RecurringTaskLogProvider = () => backgroundBootstrapConfiguration.RecurringTaskLogProvider; var result = backgroundBootstrapConfiguration.Resolve(configurationBootstrapper, scanAssemblies); // Proc config validation BackgroundApplicationConfiguration config = null; try { config = BackgroundApplicationConfiguration.Instance; } catch { } finally { if (config.IsNull()) { throw new Exception("Signals.Core.Background.Configuration.BackgroundApplicationConfiguration is not provided. Please use a configuration provider to provide configuration values!"); } } RegisterBackground(); ScheduleRecurring(); NotifyOnStartup(); return(result); }
public static int Main(string[] args) { try { Console.WriteLine("Bootstrapping..."); ConfigurationBootstrapper.Bootstrap(args, out var configuration, out var appSettingsRoot); LogBootstrapper.Bootstrap(appSettingsRoot.Application, appSettingsRoot.Logging); WebHostBootstrapper.Bootstrap <Startup>(configuration, out var webHost); Log.Debug("Starting web host"); webHost.Run(); } catch (Exception ex) { Log.Fatal(ex, "A fatal exception occurred."); return(1); } finally { Log.CloseAndFlush(); } return(0); }
public Startup(IConfiguration configuration) { Configuration = configuration; _appConfig = Configuration.GetSection("Application").Get <CctApplicationConfiguration>(); _bootstrapper = new ConfigurationBootstrapper(_container); }
public Startup(IConfiguration configuration) { Configuration = configuration; _bootstrapper = new ConfigurationBootstrapper(_container); AppConfiguration = Configuration.GetSection("App").Get <AppConfiguration>(); }
public Startup(IWebHostEnvironment env) { ConfigurationBootstrapper.LoadConfiguration(env, null); }