You can achieve this using something like config_split and Drupal’s standard settings.php
.
You can include environment specific settings using an environment var, or the URL, or just a if (file_exists($file)) {
, and then set which split to use in the include.
solved Drupal 8 Detect Dev URL, then do something