Dynamic address of mqtt broker

Good afternoon, I need to make the mqtt broker address dynamic, in other words, so that I can change it in the Web interface, and not through YAML.
It is the same with the username, password and port.
The fact is that one device can be used in different places and with different servers, and it is not very convenient to change YAML and compile the firmware.
Can you tell me if there are any solutions?

This would make absolutely no sense. When you compile the binary for the device, the MQTT IP is hard coded.

You might consider putting the MQTT broker (Mosquitto) on a separate Raspberry Pi 3 and make the IP on each the same static IP. This way when you compile the binary with the broker IP, it will work at either location.