提交 130d043a 编写于 作者: 雪洛's avatar 雪洛

update: 区分多服务空间无服务空间提示

上级 2c91525d
......@@ -6,7 +6,7 @@ const loaderUtils = require('loader-utils')
process.UNI_CLOUD = false
process.UNI_CLOUD_TCB = false
process.UNI_CLOUD_ALIYUN = false
process.env.UNI_CLOUD_PROVIDER = JSON.stringify({})
process.env.UNI_CLOUD_PROVIDER = JSON.stringify([])
if (process.env.UNI_CLOUD_SPACES) {
try {
......@@ -18,22 +18,24 @@ if (process.env.UNI_CLOUD_SPACES) {
if (spaces.length === 1) {
const space = spaces[0]
console.log(`本项目的uniCloud使用的默认服务空间spaceId为:${space.id}`)
if (space.clientSecret) {
process.env.UNI_CLOUD_PROVIDER = JSON.stringify({
provider: 'aliyun',
spaceName: space.name,
spaceId: space.id,
clientSecret: space.clientSecret,
endpoint: space.apiEndpoint
})
} else {
process.env.UNI_CLOUD_PROVIDER = JSON.stringify({
provider: 'tencent',
spaceName: space.name,
spaceId: space.id
})
}
}
}
process.env.UNI_CLOUD_PROVIDER = JSON.stringify(spaces.map(space => {
if (space.clientSecret) {
return {
provider: 'aliyun',
spaceName: space.name,
spaceId: space.id,
clientSecret: space.clientSecret,
endpoint: space.apiEndpoint
}
} else {
return {
provider: 'tencent',
spaceName: space.name,
spaceId: space.id
}
}
}))
}
} catch (e) {}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册