The newer versions of Craft CMS stimulate using environment variables in the CP. It works perfectly. I have set two variables for sites in my .env file:
DUTCH_SITE_URL="http://company.test"
ENGLISH_SITE_URL="http://company.test/en"
One thing that's not clear to me is the right way to request the baseUrl in templates. For example: I'm using a simple language switcher to switch between two languages:
{% set sites = craft.app.sites.getAllSites() | without(currentSite) %}
{% for site in sites %}
<li><a href="{{ site.baseUrl }}" title="{{ site.language }}">{{ site.language }}</a></li>
{% endfor %}
When viewing the Dutch website the language switcher shows the link to the English website. The problem is that site.baseUrl outputs the environment variables instead of the English site url. The link looks like this:
http://company.test/$ENGLISH_SITE_URL
What's the proper way to deal with this?