one option: protect the config with a mutex and read out the necessary stuff (like config.Endpoints) at the beginning of the loop