Data Dictionary
This chapter provides information about the Data Dictionary functionality in DreamFace, from an implementation point of view.
Structure of the Data Dictionary
The Data Dictionary is set per application and is structured as follow:
{
"application": "myApp",
"content": {
"ENV": {
"ip": "",
"port": "",
"settings": {
"apitoken": "",
"newstoken": ""
}
},
"customer": {
"name": "",
"address": {
"street": "",
"city": "",
"zip": "",
"country": ""
}
}
}
}
Each property represent an entity definition in the DD of the application. "ENV" is a special property that cannot be removed. It is not necessary to add more complexity in our storage system. There will be only one property that cannot be removed and if in the future there is more, exceptions will be added in a array of properties in the code. The structure above is optimized to be searched:
- retrieve the entire dictionary of an application -> returns the content property of the document
- retrieve one entity -> document.nameOfTheEntity
- retrieve ENV variables -> document.ENV
Environment Variables
Environment variables must reflect instances of the ENV property from the Data Dictionary. They are instantiated for each defined environment. Environments are defined into one document per application. Each environment is defined as a property of the document. Environments and environment variables are structured as follow:
{
"application": "myApp",
"environments": {
"dev": {
"ip": "111.222.333.444",
"port": "80",
"settings": {
"apitoken": "123456",
"newstoken": "234567"
}
},
"prod": {
"ip": "444.333.222.111",
"port": "81",
"settings": {
"apitoken": "56789",
"newstoken": "98765"
}
}
}
}
When the structure of ENV is updated on the data dictionary, a process of update of all environments is applied.