Skip to content

Commit

Permalink
feat: 支持指定阿里云 OSS endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
geekdada committed Aug 16, 2020
1 parent 7a51481 commit 1b796a5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/command/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,9 @@ class GenerateCommand extends Command {
});

const ossConfig = {
region: config?.upload?.region || 'oss-cn-hangzhou',
region: config?.upload?.region,
bucket: config?.upload?.bucket,
endpoint: config?.upload?.endpoint,
accessKeyId: ctx.env.OSS_ACCESS_KEY_ID || config?.upload?.accessKeyId,
accessKeySecret: ctx.env.OSS_ACCESS_KEY_SECRET || config?.upload?.accessKeySecret,
};
Expand Down
5 changes: 3 additions & 2 deletions lib/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ export interface CommandConfig {
readonly analytics?: boolean;
readonly checkHostname?: boolean;
readonly upload?: {
readonly prefix: string;
readonly region: string;
readonly prefix?: string;
readonly region?: string;
readonly endpoint?: string;
readonly bucket: string;
readonly accessKeyId: string;
readonly accessKeySecret: string;
Expand Down
1 change: 1 addition & 0 deletions lib/utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ export const validateConfig = (userConfig: Partial<CommandConfig>): void => {
upload: Joi.object({
prefix: Joi.string(),
region: Joi.string(),
endpoint: Joi.string(),
bucket: Joi.string().required(),
accessKeyId: Joi.string().required(),
accessKeySecret: Joi.string().required(),
Expand Down

0 comments on commit 1b796a5

Please sign in to comment.