$ cat .env
MY_VAR=my_var1
ANOTHER_VAR=my_var2
export $(cat .env | xargs)
When you source the file, the assignments will be set but the variables are not exported unless the allexport option has been set.
exporting a variable does not make it an environment variable. It just makes it an environment variable in any subshell.
ref: https://stackoverflow.com/questions/15474650/unix-what-is-the-difference-between-source-and-export