Adding properties based on configuration

Example 1 - Using a section for configuration

asp.net core Configuration

{
  "ConfigurationData": {
    "Property1": "Value1",
    "Property2": "Value2",
    "ArrayProperty": [ 12343, 324, 2342 ],
    "PropertyWithObjectAsValue": {
       "SomeProperty": "SomeValue"
    }
  } 
}

When using Inspector, we could add a section to get inspection properties

	app.UseInspector(x =>
		{
			x.AddName("Service Name - Sample Service");
			x.AddConfigurationSection(Configuration, "ConfigurationData");
		});

Now the end point https://your-application.com/version would give the following data

{
  "Name": "Service Name - Sample Service",
  "Property1": "Value1",
  "Property2": "Value2"
}

Example 2 - Complicated section

asp.net core Configuration

{
  "Node1": {
    "Node2": [
      "SomeData",
      {
        "Property1": "Value1",
        "Property2": "Value2",
        "ArrayProperty": [ 12343, 324, 2342 ],
        "PropertyWithObjectAsValue": {
          "SomeProperty": "SomeValue"
        }
      },
      2342
    ]
  }
}

When using Inspector, we could add a section as shown below

	app.UseInspector(x =>
		{
			x.AddName("Service Name - Sample Service");
			x.AddConfigurationSection(Configuration, "Node1:Node2:1");
		});

Now the end point https://your-application.com/version would give the following data

{
  "Name": "Service Name - Sample Service",
  "Property1": "Value1",
  "Property2": "Value2"
}

Back To Documentation