asp.net 核心环境变量没有传递给 vuejs 配置
asp.net core environment variable not passing to vuejs config
我正在尝试将 asp.net 核心 (kesterl) 中的环境变量设置传递给 vuejs
我的启动设置就像
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:44323/",
"sslPort": 44323
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"BEAPI_URL": "http://localhost:4000/api/v1",
"VUE_BEAPI_URL": "http://localhost:4000/api/v1"
}
},
}
}
我的vuejs配置如下
export default {
// apiUrl: 'http://localhost:4000/api/v1'
apiUrl: process.env.VUE_BEAPI_URL
}
有人帮忙点赞我的场景
除此之外,我的 vuejs 应用程序在 kesterl
下运行良好
以下设置有效
kestrel launchsettings(环境变量名参考)
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:44323/",
"sslPort": 44323
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"VUE_APP_BEAPI_URL": "http://localhost:4000/api/v1"
}
}
}
}
vuejs 配置
export default {
// apiUrl: 'http://localhost:4000/api/v1',
apiUrl: process.env.VUE_APP_BEAPI_URL,
access_token:''
}
我正在尝试将 asp.net 核心 (kesterl) 中的环境变量设置传递给 vuejs 我的启动设置就像
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:44323/",
"sslPort": 44323
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"BEAPI_URL": "http://localhost:4000/api/v1",
"VUE_BEAPI_URL": "http://localhost:4000/api/v1"
}
},
}
}
我的vuejs配置如下
export default {
// apiUrl: 'http://localhost:4000/api/v1'
apiUrl: process.env.VUE_BEAPI_URL
}
有人帮忙点赞我的场景 除此之外,我的 vuejs 应用程序在 kesterl
下运行良好以下设置有效 kestrel launchsettings(环境变量名参考)
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "https://localhost:44323/",
"sslPort": 44323
}
},
"$schema": "http://json.schemastore.org/launchsettings.json",
"profiles": {
"IIS Express": {
"commandName": "IISExpress",
"launchBrowser": true,
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development",
"VUE_APP_BEAPI_URL": "http://localhost:4000/api/v1"
}
}
}
}
vuejs 配置
export default {
// apiUrl: 'http://localhost:4000/api/v1',
apiUrl: process.env.VUE_APP_BEAPI_URL,
access_token:''
}