denoland / denoland/deno_task_shell
Can't load environment variable with space from .env file
- Dominant language
- Rust
- Stars
- 139
- Forks
- 25
- PR merge metrics
- No merged PRs in 30d
Description
Based on https://github.com/denoland/deno_task_shell/issues/30, I added this task in deno.json
```json
{
"tasks": {
"echo": "export $(cat .env | xargs) && deno eval \"console.log(Deno.env.get('DATABASE_URL'))\""
}
}
```
And my .env file is below:
```shell
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:
```shell
% 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.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.