I apologize in advance if I have missed some nuance of your situation, but it seems to me that you should have one config file with all three IP addresses, in default search order. The application could read them in and try each in sequence until it found one that worked. To manually override the search order, you could set a command line parameter for what IP to try first, for example. It seems to me this would eliminate the need for write access to the file.