What sets the domain in the Email Settings?

It’s in app.yml that was created when you ran discourse-setup. You can run it again to change it.