I'm trying to use a PHP function in .env file which is rand()
in my case.
Here is what I'm trying to achieve in .env;
PROTOCOL="http"
DOMAIN="example.com"
URI="www.{$DOMAIN}"
RAND=rand(1,5)
CDN_URI="cdn{$RAND}.{$DOMAIN}"
CDN_URL="{$PROTOCOL}://{$CDN_URI}"
As you can see, I am trying to generate random integers from 1 to 5 which represent the CDN subdomain so that in a request I would get http://cdn2.example.com
and in another one http://cdn4.example.com
and so on.
I guess using PHP in .env is not natively supported but is there any way / workaround ?
P.S. I am using Laravel 5.