I have add this functionnality here for tests:
https://github.com/1technophile/OpenMQTTGateway/tree/connection-mng
For ESP8266 the button must be connected to D5, for ESP32 you can use the BOOT button.
Regarding the ESP8266 you can also use flash button if you set TRIGGER_PIN 0 of user_config.h . In this case you should not use GPIO0 D3 for other usage like RF receiver.
The button must be pressed (at LOW) during more than 10s and it will trigger a settings erase + an ESP reset.