Follow-up: env variables were also not available in my separate app I'm using for stripe transactions, unless I repeatedly ran "php artisan config:cache". Ended up doing a hard reset from my remote repository to fix (with git clean -ffdx and a composer update). So, not sure if this is related to Statamic or just something else that got corrupted.
If you use the config:cache command, env will not work. (Only in config files)
Actually I would like to remove the env template tag.
It's best/better practice to place your env() calls within your config file, then reference the config where necessary.
You can reference the config from within your templates.
For example, the route variable in the config/statamic/cp.php file:
{{ config:statamic:cp:route }}
Most helpful comment
If you use the
config:cachecommand,envwill not work. (Only in config files)Actually I would like to remove the
envtemplate tag.It's best/better practice to place your
env()calls within your config file, then reference the config where necessary.You can reference the
configfrom within your templates.For example, the
routevariable in theconfig/statamic/cp.phpfile: