Configuration
/

Configuration Management for Different Environments

Configuration Management for Different Environments

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.

Configuration Management by Environment Differences

Step 1: Define Your Environments

  • If your application needs to run in test, development and production environments, you can use different IP addresses or endpoints for these environments. This prevents manual changes by automating environment-based settings.

Step 2: Configure the Appsetting.json File

  • You can use the appsettings.json file to store IP addresses or endpoints for each environment on the Kuika platform.
  • You can store data for test, development and production environments using the following format:
“MySettings”: { “TestVar”: “Test Environment”, “DevVar”: “Development Environment”, “ProdVar”: “Production Environment” }

Step 3: Reading Data Based on Ambient Information

  • You can use the following Custom C# code to dynamically read data from different media into your application.
  • Follow these steps to use the data source:
    • Log in to the Kuika platform.
    • Select the project you will work with from the Apps screen.
  • Go to the Datasources module.
  • Click the + icon next to the Sources heading to add a new data source.
  • Select C# as the Data Sources type, enter a name and click the CREATE button.

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

  • The “GetVariable()” function reads the data in the appsettings.json file and retrieves the relevant IP and endpoint value according to the environment in which the application is running.

Step 5: Ease in the Publishing Process

  • With this structure, you do not manually change IP or endpoint information for different environments before each broadcast. The application automatically uses the correct settings according to the environment information.

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.

No items found.

Other Related Content

No items found.

Glossary

No items found.

Alt Başlıklar

Start with video courses