access env variable in collection YAML #6619
Replies: 4 comments 8 replies
-
Why does it have to be in the collection yaml? |
Beta Was this translation helpful? Give feedback.
-
This is the only solution I have: Set the config
Make a custom tag:
and use it like this in the YAML file:
|
Beta Was this translation helpful? Give feedback.
-
But the front end url has nothing to do with the collection right? It's global? |
Beta Was this translation helpful? Give feedback.
-
Is the custom tag option still supposed to work in Statamic 5? I would like to pass a env variable into the collection yaml file so I change between local & prod by just using .env variables. |
Beta Was this translation helpful? Give feedback.
-
I am trying to set the url for the preview_target for a collection via env variable.
I've tried this: https://v2.statamic.com/environments#option-interpolation (this is for statamic 2)
{env:FRONTEND_URL}
and I've tried to read from the config:
config/app.php ->
'frontend_url' => env('FRONTEND_URL', 'http://localhost:3000'),
and then in .YAML file {config:app:frontend_url}
nothing works
Does anybody know how this is possible?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions