How to deal with a situation when I need to change config file structure?
For example, let's say I want to change it from this
{
"device_address": "127.0.0.1:5001"
}
to this
{
"device": {
"ip": "127.0.0.1",
"port": 5001
}
}
If I'll do so, the new program release will fail to read it, which will cause the configuration will be lost, which is bad:(
But I can't stack with the same config structure forever - project is changing, requirements are changing...
Does anyone know any best practices for this issue?
I don't know if this qualifies as a "best practice", but one way is to do this migration in several steps:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.