mirror of
https://github.com/cool-team-official/cool-admin-midway-packages.git
synced 2026-01-06 09:28:11 +00:00
阿里云OSS增加公网访问域名配置
This commit is contained in:
parent
d15ae19f33
commit
ccfc401390
@ -78,7 +78,13 @@ export class CoolFile {
|
|||||||
this.client = new QINIU.auth.digest.Mac(accessKeyId, accessKeySecret);
|
this.client = new QINIU.auth.digest.Mac(accessKeyId, accessKeySecret);
|
||||||
}
|
}
|
||||||
if (aws) {
|
if (aws) {
|
||||||
const { accessKeyId, secretAccessKey, region, publicDomain, forcePathStyle } = aws;
|
const {
|
||||||
|
accessKeyId,
|
||||||
|
secretAccessKey,
|
||||||
|
region,
|
||||||
|
publicDomain,
|
||||||
|
forcePathStyle,
|
||||||
|
} = aws;
|
||||||
this.client = new S3Client({
|
this.client = new S3Client({
|
||||||
region,
|
region,
|
||||||
credentials: { accessKeyId, secretAccessKey },
|
credentials: { accessKeyId, secretAccessKey },
|
||||||
@ -173,7 +179,8 @@ export class CoolFile {
|
|||||||
if (isCloud) {
|
if (isCloud) {
|
||||||
if (oss) {
|
if (oss) {
|
||||||
const ossClient: OSS = this.getMetaFileObj();
|
const ossClient: OSS = this.getMetaFileObj();
|
||||||
return (await ossClient.put(name, data)).url;
|
const { url } = await ossClient.put(name, data);
|
||||||
|
return oss.publicDomain ? `${oss.publicDomain}/${name}` : url;
|
||||||
}
|
}
|
||||||
if (cos) {
|
if (cos) {
|
||||||
const cosClient: COS = this.getMetaFileObj();
|
const cosClient: COS = this.getMetaFileObj();
|
||||||
@ -244,7 +251,8 @@ export class CoolFile {
|
|||||||
if (mode == MODETYPE.CLOUD) {
|
if (mode == MODETYPE.CLOUD) {
|
||||||
if (oss) {
|
if (oss) {
|
||||||
const ossClient: OSS = this.getMetaFileObj();
|
const ossClient: OSS = this.getMetaFileObj();
|
||||||
return (await ossClient.put(key, data)).url;
|
const { url } = await ossClient.put(key, data);
|
||||||
|
return oss.publicDomain ? `${oss.publicDomain}/${key}` : url;
|
||||||
}
|
}
|
||||||
if (cos) {
|
if (cos) {
|
||||||
const cosClient: COS = this.getMetaFileObj();
|
const cosClient: COS = this.getMetaFileObj();
|
||||||
@ -391,6 +399,7 @@ export class CoolFile {
|
|||||||
expAfter = 300000,
|
expAfter = 300000,
|
||||||
maxSize = 200 * 1024 * 1024,
|
maxSize = 200 * 1024 * 1024,
|
||||||
host,
|
host,
|
||||||
|
publicDomain,
|
||||||
} = this.config.oss;
|
} = this.config.oss;
|
||||||
const oss = {
|
const oss = {
|
||||||
bucket,
|
bucket,
|
||||||
@ -420,6 +429,7 @@ export class CoolFile {
|
|||||||
signature,
|
signature,
|
||||||
policy,
|
policy,
|
||||||
host: newHost,
|
host: newHost,
|
||||||
|
publicDomain,
|
||||||
OSSAccessKeyId: accessKeyId,
|
OSSAccessKeyId: accessKeyId,
|
||||||
success_action_status: 200,
|
success_action_status: 200,
|
||||||
};
|
};
|
||||||
|
|||||||
@ -67,6 +67,8 @@ export interface OSSConfig {
|
|||||||
maxSize?: number;
|
maxSize?: number;
|
||||||
// host
|
// host
|
||||||
host?: string;
|
host?: string;
|
||||||
|
// 阿里云oss的公网访问地址
|
||||||
|
publicDomain: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user