There is a free package in the Codesys store for this. That package is very very powerful. I have used this package in a project and using it was a breeze.
Apart from providing a mechanic for free arrangeable IO channels, with different datatypes (BOOL, BYTE, WORD etc etc), it can restore previous made configurations and store current configurations onto disk.
It's called IO mapping tool, check it out: https://store.codesys.com/io-mapping-tool.html
Plus, it's open source so you can take a look inside the library to learn more about it's mechanics
(Scroll down for my projects)