deno_task_shell
deno_task_shell copied to clipboard
Can't load environment variable with space from .env file
Based on https://github.com/denoland/deno_task_shell/issues/30, I added this task in deno.json
{
"tasks": {
"echo": "export $(cat .env | xargs) && deno eval \"console.log(Deno.env.get('DATABASE_URL'))\""
}
}
And my .env file is below:
DATABASE_URL="Provider=MSOLEDBSQL;Data Source=localhost:1433;Initial Catalog=AdventureWorks;User ID=sa;Password=password
When running deno task echo, the following output is produced:
% deno task echo
Task echo export $(cat .env | xargs) && deno eval "console.log(Deno.env.get('DATABASE_URL'))"
Provider=MSOLEDBSQL;Data
Note that the environment variable value is cut off after the first white space.