Пример #1
0
 public Startup(IConfiguration configuration)
 {
     Configuration = new SchemaConfigurationBinder(configuration);
     Configuration.Bind("JwtAuth", authConfig);
     Configuration.Bind("AppConfig", appConfig);
     Configuration.Bind("ClientConfig", clientConfig);
     Configuration.Bind("Cors", corsOptions);
 }
Пример #2
0
        public static IServiceCollection AddConnectedServices(this IServiceCollection services, SchemaConfigurationBinder configuration)
        {
            services.AddThreaxAzureStorageDataProtection(o => configuration.Bind("Storage", o), o => configuration.Bind("AzureDataProtection", o));

            services.AddThreaxAppInsights(o =>
            {
                o.ApplicationVersion = Assembly.GetEntryAssembly().GetName().Version.ToString();
                configuration.Bind("AppInsights", o);
            });

            return(services);
        }
Пример #3
0
        public Startup(IConfiguration configuration)
        {
            Configuration = new SchemaConfigurationBinder(configuration);
            Configuration.Bind("JwtAuth", authConfig);
            Configuration.Bind("AppConfig", appConfig);
            Configuration.Bind("Cors", corsOptions);
            Configuration.Define("Build", typeof(Threax.DockerBuildConfig.BuildConfig));
            Configuration.Define("Deploy", typeof(Threax.DeployConfig.DeploymentConfig));

            if (string.IsNullOrWhiteSpace(appConfig.CacheToken))
            {
                appConfig.CacheToken = this.GetType().Assembly.ComputeMd5ForAllNearby();
            }
        }
Пример #4
0
        static void Main(String[] args)
        {
            try
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                var appDir = Path.GetDirectoryName(Environment.GetCommandLineArgs()[0]);

                var configBuilder = new ConfigurationBuilder();
                configBuilder.AddJsonFile(Path.Combine(appDir, "appsettings.json"));
                configBuilder.AddJsonFile(Path.Combine(appDir, "appsettings.Production.json"), optional: true);
                configBuilder.AddJsonFile(Path.Combine(appDir, "appsettings.secrets.json"), optional: true);
                var configuration = new SchemaConfigurationBinder(configBuilder.Build());

                var eventConfig = new EventConfig();
                configuration.Bind("Events", eventConfig);

                //setup our DI
                var services = new ServiceCollection();

                services.AddSingleton <DetectorForm>()
                .AddSingleton <EventConfig>(eventConfig);

                services.AddHalcyonClient();

                services.AddHomeClient(o => configuration.Bind("HomeClient", o))
                .SetupHttpClientFactoryWithClientCredentials(o =>
                {
                    configuration.Bind("HomeClient", o);
                });

                var serviceProvider = services.BuildServiceProvider();

                DetectorForm form = serviceProvider.GetRequiredService <DetectorForm>();
                Application.Run(form);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().Name, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Пример #5
0
 public Startup(IConfiguration configuration)
 {
     Configuration = new SchemaConfigurationBinder(configuration);
     Configuration.Bind("AppConfig", appConfig);
 }
Пример #6
0
        public static IServiceCollection AddConnectedServices(this IServiceCollection services, SchemaConfigurationBinder configuration)
        {
            services.AddThreaxAzureStorageDataProtection(o => configuration.Bind("Storage", o), o => configuration.Bind("AzureDataProtection", o));

            return(services);
        }