Using .env variable in yaml

Hey guys,

I’m trying to use a variable from my .env-file in a yaml-file.

The usecase is to outsource my mailserver settings and use them with the SymfonyMailer Config.

#.env
MAILER_DSN='smtp://formular@test.de:password123@smtp.example.com:465'
#Settings.Mailform.yaml
Sitegeist:
  Neos:
    SymfonyMailer:
      dsn: '%env(MAILER_DSN)%'

When I paste the server settings directly into the config, it works fine. But with the variable it does not.

Am I missing something?

I don’t know about %env()%. I always use env-variables like this: '%env:MAILER_DSN%'.

1 Like

Right, the syntax is %env:<VARIABLE>% .
Since Flow 8.1 the type can be casted: %env(<type>):<VARIABLE>%, for example: %env(string):MAILER_DSN%

See Flow 8.1 — Flow Framework 8.3.x documentation

1 Like