Dotenv: [Feature Request] Allow variables in .env

Created on 16 Nov 2017  路  5Comments  路  Source: motdotla/dotenv

It would be nice to be able to use variables in the .env file similar to Laravel.

PROTOCOL=https://
HOST_NAME=dev.mysite.com
HTTP_PORT=443
APP_URL=${PROTOCOL}${HOST_NAME}:${HTTP_PORT}

PHP DotEnv reference: https://github.com/vlucas/phpdotenv#nesting-variables

Most helpful comment

The example .env file in that project seems to indicate you can use variables from the same .env file (e.g. look at MONGOLAB_USER). If you tested and it doesn't work, I'd open an issue there.

All 5 comments

Is this what you're wanting? https://github.com/motdotla/dotenv#what-about-variable-expansion

@zenflow - it seems similar but the variable-expansion you referenced seems to be limited to machine variables rather than other variables in the same .env file.

The example .env file in that project seems to indicate you can use variables from the same .env file (e.g. look at MONGOLAB_USER). If you tested and it doesn't work, I'd open an issue there.

hmm - i looked at that .env example previously and did not see an example of re-using a variable that was defined in that same file. i'll check again.

ok - yeah i see now. the MONGOLAB_USER you referenced. thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Vandivier picture Vandivier  路  3Comments

Jakobud picture Jakobud  路  3Comments

acharotariya picture acharotariya  路  3Comments

datasmurfen picture datasmurfen  路  5Comments

AndrewChen1982 picture AndrewChen1982  路  4Comments