{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-guides/sidebars.yaml"},"props":{"metadata":{"markdoc":{"tagList":[]},"type":"markdown"},"seo":{"title":"Configuration","description":"Accelerate E&P application development and protect your innovation by consuming our Data and Domain APIs / Platform APIs.","lang":"en-US","meta":[{"name":"robots","content":"noindex"}],"llmstxt":{"hide":true,"excludeFiles":[]}},"dynamicMarkdocComponents":[],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"configuration","__idx":0},"children":["Configuration"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configuration is the process of specifying settings and parameters that control the behavior of an application. The sections below show how to access"," ","Configuration settings and to monitor for changes in the configuration at runtime. The SDK constructs the configuration using several sources, as"," ","described in the ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/agora/overview#configuration"},"children":["Configuration Sources"]}," section."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"accessing-configuration-settings","__idx":1},"children":["Accessing Configuration Settings"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Configuration setting values are accessed using a singleton and  are accessed hierarchically by separating the levels of the hierarchy with colons."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Examples:"]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["All examples use the following configuration:"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["AEA.json"]},":"]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"json","header":{"controls":{"copy":{}}},"source":"{\n    \"App\" : {\n        \"SomeSetting\": true,\n        \"Fruit\": [ \"Apple\", \"Banana\", \"Pear\" ],\n        \"FruitObjects\": [ {\"Name\": \"Apple\"}, {\"Name\": \"Banana\"}, {\"Name\": \"Pear\"}]\n    }\n}\n","lang":"json"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"retrieving-a-setting","__idx":2},"children":["Retrieving a setting"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_","__idx":3},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/net"},"children":["NET"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using static Agora.SDK;\n...\nConsole.Writeline(Config[\"App:SomeSetting\"]);\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-1","__idx":4},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/python"},"children":["Python"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"from agoraiot import config\n...\nprint( config[\"App:SomeSetting\"] )\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"retrieving-an-array","__idx":5},"children":["Retrieving an array"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-2","__idx":6},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/net"},"children":["NET"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using static Agora.SDK;\nusing Microsoft.Extensions.Configuration;\n...\nvar fruits = Config.GetSection(\"App:Fruit\").Get<List<string>>();\n\nforeach(var fruit in fruits)\n    Console.WriteLine(fruit);\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-3","__idx":7},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/python"},"children":["Python"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"from agoraiot import config\n\nfruits = config[\"App:Fruit\"]\n\nfor fruit in fruits:\n    print( fruit )\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":["Output:"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"plaintext","header":{"controls":{"copy":{}}},"source":"Apple\nBanana\nPear\n","lang":"plaintext"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"accessing-array-of-objects","__idx":8},"children":["Accessing array of Objects"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-4","__idx":9},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/net"},"children":["NET"]}]},{"$$mdtype":"Tag","name":"blockquote","attributes":{},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["[!IMPORTANT]"," ","For .NET, one typically deploys containers using single, trimmed executables. Configration binding and autopopulation of"," ","object elements can fail at run-time due required code for the functionality is trimmed, making the deployed application"," ","run differently than during development.  To fix this issue, Microsoft introduced > a project setting that affects .NET 8"," ","to enable auto-generation of binding code."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["To enable this feature, add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<EnableConfigurationBindingGenerator>true</EnableConfigurationBindingGenerator>"]}," to ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["<PropertyGroup>"]}," ","in the csproj files using configuration / objecting binding."]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using static Agora.SDK;\nusing Microsoft.Extensions.Configuration;\n\nclass Fruit { public string Name { get; set; } }\n\nList<Fruit> fruits = Config.GetSection(\"App:FruitObjects\").Get<List<Fruit>>();\n\nforeach(var fruit in fruits)\n    Console.WriteLine(fruit.Name);\n\n// example using binding\n\nList<Fruit> fruits = [];\n\nConfig.GetSection(\"App:FruitObjects\").Bind(fruits);\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-5","__idx":10},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/python"},"children":["Python"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"from agoraiot import config\n\nclass Fruit:\n    def __init__(self, name):\n        self.name = name\n\nfruits = config[\"App:FruitObjects\"]\n\nfor fruitdata in fruits\n    fruit = Fruit(fruitdata[\"Name\"])\n\n# to deserialize directly you will need to create custom json encoders/decoders\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"setting-default-configuration-settings-and-overrides","__idx":11},"children":["Setting Default Configuration Settings and Overrides"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The configuration is built from a set of sources that starts with Defaults and ends with Overrides as shown in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/solutions/agora/overview#configuration"},"children":["Configuration Overview"]},".",{"$$mdtype":"Tag","name":"br","attributes":{},"children":[]},"To set defaults or overrides use the Defaults or Overrides dictionaries."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"example","__idx":12},"children":["Example:"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-6","__idx":13},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/net"},"children":["NET"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using static Agora.SDK;\n\n...\nConfig.Defaults[\"App:SettingName\"] = \"Default value if none provided\";\nConfig.Overrides[\"App:OtherSettingName\"] = \"Overrides all other sources\";\nConfig.Build();\n\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-7","__idx":14},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/python"},"children":["Python"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"from agoraiot import config\n\n...\nconfig.defaults[\"App:SettingName\"] = \"Default value if none provided\";\nconfig.overrides[\"App:OtherSettingName\"] = \"Overrides all other sources\";\nconfig.build()\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"runtime-configuration-changes","__idx":15},"children":["Runtime Configuration Changes"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["The alternate configuration and any Key-Per-File settings allow application settings to be modified while the application is running.  An application should monitor"," ","the Configuration (as a whole) or an individual settings has changed if a run-time change is allowed."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"monitoring-for-configuration-changes","__idx":16},"children":["Monitoring for Configuration Changes"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-8","__idx":17},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/net"},"children":["NET"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"    Config.Changed += ConfigChanged;\n...\n    private void ConfigChanged(object? sender, EventArgs e)\n    {\n        \"Configuration Changed\".LogInfo();\n    }\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-9","__idx":18},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/python"},"children":["Python"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"def config_change_handler():\n    logger.info(\"Configuration Changed\")\n\nconfig.observe_config( config_change_handler )\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"monitoring-for-configuration-changes-of-individual-settings","__idx":19},"children":["Monitoring for Configuration Changes of Individual Settings"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-10","__idx":20},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/net"},"children":["NET"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"var mySetting = Agora.ObservableSetting.Get(\"AEA2:LogLevel\");\nmySetting.PropertyChange += SettingChange;\n\n...\nprivate void SettingChange( object? sender, \n                            System.ComponentModel.PropertyChangedEventArgs e)\n{\n    if (sender is Agora.ObservableSetting o)\n        $\"Setting Changed to `{o.Value}'\".LogInfo();\n}\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-11","__idx":21},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/python"},"children":["Python"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"def setting_changed(val):\n    logger.info(f\"Setting Changed to {val}\")\n\nconfig.observe(\"AEA2:LogLevel\", setting_changed )\n","lang":"python"},"children":[]},{"$$mdtype":"Tag","name":"hr","attributes":{},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"configuration-to-json","__idx":22},"children":["Configuration to JSON"]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-12","__idx":23},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/net"},"children":["NET"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"csharp","header":{"controls":{"copy":{}}},"source":"using Microsoft.Extensions.Configuration;\n\nvar json = Config.SerializeToJson();\nif ( json != null )\n    json.ToJsonString(new JsonSerializerOptions() { WriteIndented = true }).LogInfo();\n","lang":"csharp"},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"_-13","__idx":24},"children":[{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"#tab/python"},"children":["Python"]}]},{"$$mdtype":"Tag","name":"CodeBlock","attributes":{"data-language":"python","header":{"controls":{"copy":{}}},"source":"from agoraiot import config, logger\nimport json\n\nlogger.info( json.dumps(config, indent=4) )\n","lang":"python"},"children":[]}]},"headings":[{"value":"Configuration","id":"configuration","depth":2},{"value":"Accessing Configuration Settings","id":"accessing-configuration-settings","depth":3},{"value":"Retrieving a setting","id":"retrieving-a-setting","depth":4},{"value":"","id":"_","depth":1},{"value":"","id":"_-1","depth":1},{"value":"Retrieving an array","id":"retrieving-an-array","depth":4},{"value":"","id":"_-2","depth":1},{"value":"","id":"_-3","depth":1},{"value":"Accessing array of Objects","id":"accessing-array-of-objects","depth":4},{"value":"","id":"_-4","depth":1},{"value":"","id":"_-5","depth":1},{"value":"Setting Default Configuration Settings and Overrides","id":"setting-default-configuration-settings-and-overrides","depth":3},{"value":"Example:","id":"example","depth":4},{"value":"","id":"_-6","depth":1},{"value":"","id":"_-7","depth":1},{"value":"Runtime Configuration Changes","id":"runtime-configuration-changes","depth":3},{"value":"Monitoring for Configuration Changes","id":"monitoring-for-configuration-changes","depth":4},{"value":"","id":"_-8","depth":1},{"value":"","id":"_-9","depth":1},{"value":"Monitoring for Configuration Changes of Individual Settings","id":"monitoring-for-configuration-changes-of-individual-settings","depth":4},{"value":"","id":"_-10","depth":1},{"value":"","id":"_-11","depth":1},{"value":"Configuration to JSON","id":"configuration-to-json","depth":3},{"value":"","id":"_-12","depth":1},{"value":"","id":"_-13","depth":1}],"frontmatter":{"seo":{"title":"Configuration"}},"lastModified":"2025-12-26T10:54:07.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/solutions/agora/referencemanual/configuration","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}