mirror of
https://github.com/certd/certd.git
synced 2026-04-24 04:17:25 +08:00
perf: 修改sql升级语句,兼容mysql5.7
This commit is contained in:
@@ -4,7 +4,7 @@ import { MidwayConfig } from '@midwayjs/core';
|
||||
// import { fileURLToPath } from 'node:url';
|
||||
// // const __filename = fileURLToPath(import.meta.url);
|
||||
// const __dirname = dirname(fileURLToPath(import.meta.url));
|
||||
import { FlywayHistory } from '@certd/midway-flyway-js';
|
||||
import { FlywayHistory, setFlywayLogger } from '@certd/midway-flyway-js';
|
||||
import { UserEntity } from '../modules/sys/authority/entity/user.js';
|
||||
import { PipelineEntity } from '../modules/pipeline/entity/pipeline.js';
|
||||
//import { logger } from '../utils/logger';
|
||||
@@ -15,6 +15,7 @@ import { commercialEntities } from '@certd/commercial-core';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { DefaultUploadFileMimeType, uploadWhiteList } from '@midwayjs/upload';
|
||||
import path from 'path';
|
||||
import { logger } from '@certd/basic';
|
||||
|
||||
const env = process.env.NODE_ENV || 'development';
|
||||
|
||||
@@ -137,4 +138,6 @@ mergeConfig(development, 'development');
|
||||
|
||||
mergeConfig(development, env);
|
||||
|
||||
setFlywayLogger(logger);
|
||||
|
||||
export default development;
|
||||
|
||||
@@ -78,7 +78,7 @@ export class MainConfiguration {
|
||||
app: koa.Application;
|
||||
|
||||
async onReady() {
|
||||
|
||||
// 设置flyway logger
|
||||
|
||||
|
||||
// add middleware
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { AccessInput, BaseAccess, IsAccess } from "@certd/pipeline";
|
||||
import { AliyunAccess } from "./aliyun-access.js";
|
||||
|
||||
@IsAccess({
|
||||
name: "alioss",
|
||||
@@ -36,6 +37,15 @@ export class AliossAccess extends BaseAccess {
|
||||
title: "Bucket",
|
||||
helper: "存储桶名称",
|
||||
required: true,
|
||||
component: {
|
||||
name: "remote-auto-complete",
|
||||
vModel: "value",
|
||||
type: "access",
|
||||
action: AliossAccess.prototype.onGetBucketList.name,
|
||||
search: false,
|
||||
pager: false,
|
||||
watches: ["accessId", "region"],
|
||||
},
|
||||
})
|
||||
bucket!: string;
|
||||
|
||||
@@ -76,6 +86,32 @@ export class AliossAccess extends BaseAccess {
|
||||
}
|
||||
}
|
||||
|
||||
async onGetBucketList() {
|
||||
const access = (await this.ctx.accessService.getById(this.accessId)) as AliyunAccess;
|
||||
const client = await this.getClient(access);
|
||||
|
||||
let res;
|
||||
const buckets = [];
|
||||
do {
|
||||
const requestData = { marker: res?.nextMarker || null, "max-keys": 1000 };
|
||||
res = await client.listBuckets(requestData);
|
||||
buckets.push(...(res?.buckets || []));
|
||||
} while (!!res?.nextMarker);
|
||||
return buckets.filter(bucket => bucket?.region === this.region).map(bucket => ({ label: `${bucket.name}<${bucket.region}>`, value: bucket.name }));
|
||||
}
|
||||
|
||||
async getClient(access: AliyunAccess) {
|
||||
// @ts-ignore
|
||||
const OSS = await import("ali-oss");
|
||||
return new OSS.default({
|
||||
accessKeyId: access.accessKeyId,
|
||||
accessKeySecret: access.accessKeySecret,
|
||||
// yourRegion填写Bucket所在地域。以华东1(杭州)为例,Region填写为oss-cn-hangzhou。
|
||||
region: this.region,
|
||||
//@ts-ignore
|
||||
authorizationV4: true,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
new AliossAccess();
|
||||
|
||||
Reference in New Issue
Block a user