How to safely have configuration information for different environments without restarting the application.

0
Hi there, I am having trouble with the following. For example, let's say I want to output a csv file to a certain bucket in S3. S3 creates buckets for Acceptance and Production environments, respectively. If the Entity has this connection information (e.g., bucket, connection key), when a problem occurs in the production environment, if I restore the production environment data to the Local environment for investigation, I may accidentally connect to the production S3 environment. This is very scary. On the other hand, with Constants, this situation does not occur, but for example, if I want to change the connection information, I need to restart the application. The application I am creating does not allow for frequent restarts. In this situation, is there any other way to switch the connection information without restarting the application? Thank you in advance!
asked
2 answers
1

Add a environment variable (‘constant’) named ‘EnvironmentLetter’ to your app. This is an important first step, but you need to make sure that the Environmentletter is set to the correct value, ‘D’ for local, ‘T’ for test, ‘A’ for Acceptance, ‘P’ for production and so on. Add module ‘EnvironmentVariables’ to your app. This takes care of that problem. If a noob-teammemver sets the value of constant Environmentletter to ‘P’ on your test-environment, it will log an errormessage and simply not complete the startup.

Having done this, now in your microflow you can know for certain, which environment you are in: or use one of the rules to check if you are on production or not:

So now you can create an entity with environment-specific configuration and safely set the configuration settings at runtime without the risk of using the wrong environment-setting by mistake.

 

answered
1

1- you can create on constant call it environment (Local ,testing ,Production) locale it will be the default value 

2- create an entity to fill your configuration and at the configuration entity create one enumeration have the Same values at the constant and you can fill the values throught after startup MF 

3-At the place you are using the configuration entity validate the value based on the constant and the enumeration 

4-Then I don’t think so once you restore your data it will be risky because now one the environment constant no need to change and the entity will contain 3 records linked with an enumeration and at the MF you will validate based on the environment constant 

 

Hope my answer meets your expectation and resolve your problem .

answered