How to have code/sketch that's easily toggleable to work on different nodes
You can put the per-node parameters in a external EEPROM and load them during setup(). For example the IP address is the first 16 bytes of the eeprom (IPv6), the next bytes would the the topic, etc.. 

That way every node has exactly the same sketch and the customization is in the eeprom that you could put in a socket and possibly have a separate programmer for them. 

EEPROMs with I2C interface are easy enough to get and can store 64kB. Which should be more than enough for most things.