Beispiel #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(o => o.AddPolicy(_corsPolicy, builder =>
            {
                //TODO: for now this works....  Might want to restrict this or off-load the cors to NGINX or something...
                builder.AllowAnyOrigin()
                .AllowAnyMethod()
                .AllowAnyHeader();
            }));

            if (_environmentName.ToLower() == "development")
            {
                // Register the Swagger generator, defining one or more Swagger documents
                services.AddSwaggerGen(c =>
                {
                    c.SwaggerDoc("v1", new Info {
                        Title = "ACV Identity API", Version = "v1"
                    });
                });
            }

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2);

            IoCSetup.CustomSetup(services, Configuration);
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            //one argument must be passed in which is the environment to run as..
            Console.WriteLine("Running as environment: " + args[0].Trim());

            //set up configuration...
            IConfigurationRoot configuration = ConfigurationSetup.SetUpConfigs(args[0].Trim());

            //set up my IoC container....
            var provider = IoCSetup.CustomSetup(configuration);

            //resolve my dependencies
            var consumer                 = provider.GetService <IMessageConsumer>();
            var brokerSetings            = provider.GetService <IOptions <MessageBrokerConfigSingleton> >().Value;
            var userLoggedInEventHandler = provider.GetService <IHandleUserLoggedInEvent>();

            consumer.ListenAndConsumeMessage <UserLoggedInEvent>(brokerSetings.EventsTopicName, userLoggedInEventHandler.Handle);
        }