这是我的tasks.json
:
{
"version": "2.0.0",
"tasks": [
{
"label": "login",
"type": "shell",
"command": "go run main.go login",
"options": {
"env": {
"dbConnectionString": "host=localhost port=5431 user=user dbname=db password=pass sslmode=disable",
"spotifyClientID": "some-value",
"spotifyClientSecret": "another-value"
}
},
"group": {
"kind": "build",
"isDefault": true
}
},
{
"label": "getPlaylists",
"type": "shell",
"command": "go run main.go getPlaylists",
"options": {
"env": {
"dbConnectionString": "host=localhost port=5431 user=user dbname=db password=pass sslmode=disable",
"spotifyClientID": "some-value",
"spotifyClientSecret": "another-value"
}
},
"group": {
"kind": "build",
"isDefault": true
}
}
]
}
我不想在每个任务中复制粘贴相同的环境变量。可能有一种方法可以在一个地方定义所有环境变量,然后在每个任务中重复使用它们?
这个配置对我有用:
{ "version": "2.0.0",
"options":{
"env":{}
},
"tasks": [ ]
}