During application development, different IP addresses or endpoints need to be managed for different environments such as test, development and production. Each environment may have its own settings and endpoint information. On the Kuika platform, you can automate this management through configuration files. In this course, you will learn configuration management for different environments and how to read data from appsettings.json file.
Step 1: Define Your Environments
Step 2: Configure the Appsetting.json File
“MySettings”: { “TestVar”: “Test Environment”, “DevVar”: “Development Environment”, “ProdVar”: “Production Environment” }
Step 3: Reading Data Based on Ambient Information
Custom C# Code Example:
using Kuika.Common.Attributes;using Kuika.Common.Enums;using Newtonsoft.Json;using System;using System.Text.Json.Serialization;namespace Kuika.ThirdPartyApisCollection{public class GetVariableClass{public static string GetVariable(){var variable = ConfigurationHelper.GetEnvinronmentOrAppSettings<MySettings>(“testVar”);return variable.TestVar;}}[KSettingSectionName(“MySettings”)]public class MySettings{[JsonProperty(“testVar”)][JsonPropertyName(“testVar”)]public string TestVar { get; set; }}}Step
4: Automatic Data Usage Based on Environment Information
Step 5: Ease in the Publishing Process
In this training content, you learned configuration management for different environments on the Kuika platform and the processes of reading data from appsettings.json file.