Ejemplo n.º 1
0
        //////////////////////////////////////////////////////////////
        /// <summary>
        ///   This method is responsible for handling the bootstap
        ///   configuration process for the ErrorTrace system.
        /// </summary>
        /// <param name="props">the supplier</param>
        //////////////////////////////////////////////////////////////

        private static void Initialize()
        {
            if (_init)
            {
                return;
            }

            try
            {
                IConfigSupplier ics = new PropertiesConfigSupplier("errortrace");
//Console.WriteLine(TownleyEnterprises.IO.Serializer.ConfigToPropertiesString(ics));
                ConfigRegistry.RegisterSupplier(ics);
            }
            catch (IOException)
            {
                // valid to not have the properties file
            }

            _props = ConfigRegistry.GetConfig("errortrace");
            LoadSettings(_props);

            // FIXME:  not really sure how to do this at the
            // moment...

//		try
//		{
//			// load in reverse order
//			InputStream is = ErrorTrace.class.getResourceAsStream("/errortrace.properties");
//			if(is != null)
//			{
//				_props.load(is);
//			}
//
//			// check for the errortrace.properties in the system
//			String s = System.getProperty("errortrace.properties");
//			if(s != null)
//			{
//				is = new FileInputStream(s);
//				_props.load(is);
//			}
//
//			// load from the command-line
//			_props.putAll(System.getProperties());
//
//			// take care of setting them all
//			loadSettings(_props);
//		}
//		catch(IOException e)
//		{
//			e.printStackTrace();
//		}
        }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            ConfigRegistry.RegisterConfiguration(services, Configuration);

            services.AddHealthChecks().UseTyrolSkyChecks();

            services.AddHealthChecksUI(settings => {
                // Set the maximum history entries by endpoint that will be served by the UI api middleware
                settings.MaximumHistoryEntriesPerEndpoint(50);
            })
            .AddInMemoryStorage();
            services.AddControllers();
            var redisConfig = Configuration.GetSection("Redis").Get <RedisConfiguration>();

            services.AddStackExchangeRedisExtensions <NewtonsoftSerializer>(redisConfig);
            services.AddHealthChecks().AddRedis("localhost:6379");

            services.AddSwaggerGen(c => { c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "TyrolSky.Portal", Version = "v1"
                }); });
        }