Loading in JavaScript that requires custom vars
If the settings are global and don't vary per use, I'd implement hook_library_info_alter() and dynamically set the path there. JW Player does something like that: http://cgit.drupalcode.org/jw_player/tree/jw_player.module?h=8.x-1.x#n206

Remember to clear the cache when the settings are changed, so this is updated.

If it's something completely dynamic, or per user or so, you have to either write JS to load it or embed the js tag yourself, e..g with html_head.