forked from FoundKeyGang/FoundKey
parent
0e45f10d99
commit
c88902e640
6 changed files with 36 additions and 2 deletions
14
migration/1611547387175-objectStorageS3ForcePathStyle.ts
Normal file
14
migration/1611547387175-objectStorageS3ForcePathStyle.ts
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
import {MigrationInterface, QueryRunner} from "typeorm";
|
||||||
|
|
||||||
|
export class objectStorageS3ForcePathStyle1611547387175 implements MigrationInterface {
|
||||||
|
name = 'objectStorageS3ForcePathStyle1611547387175'
|
||||||
|
|
||||||
|
public async up(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" ADD "objectStorageS3ForcePathStyle" boolean NOT NULL DEFAULT true`);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async down(queryRunner: QueryRunner): Promise<void> {
|
||||||
|
await queryRunner.query(`ALTER TABLE "meta" DROP COLUMN "objectStorageS3ForcePathStyle"`);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -175,6 +175,7 @@
|
||||||
<MkSwitch v-model:value="objectStorageUseSSL" :disabled="!useObjectStorage">{{ $ts.objectStorageUseSSL }}<template #desc>{{ $ts.objectStorageUseSSLDesc }}</template></MkSwitch>
|
<MkSwitch v-model:value="objectStorageUseSSL" :disabled="!useObjectStorage">{{ $ts.objectStorageUseSSL }}<template #desc>{{ $ts.objectStorageUseSSLDesc }}</template></MkSwitch>
|
||||||
<MkSwitch v-model:value="objectStorageUseProxy" :disabled="!useObjectStorage">{{ $ts.objectStorageUseProxy }}<template #desc>{{ $ts.objectStorageUseProxyDesc }}</template></MkSwitch>
|
<MkSwitch v-model:value="objectStorageUseProxy" :disabled="!useObjectStorage">{{ $ts.objectStorageUseProxy }}<template #desc>{{ $ts.objectStorageUseProxyDesc }}</template></MkSwitch>
|
||||||
<MkSwitch v-model:value="objectStorageSetPublicRead" :disabled="!useObjectStorage">{{ $ts.objectStorageSetPublicRead }}</MkSwitch>
|
<MkSwitch v-model:value="objectStorageSetPublicRead" :disabled="!useObjectStorage">{{ $ts.objectStorageSetPublicRead }}</MkSwitch>
|
||||||
|
<MkSwitch v-model:value="objectStorageS3ForcePathStyle" :disabled="!useObjectStorage">s3ForcePathStyle</MkSwitch>
|
||||||
</template>
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div class="_footer">
|
<div class="_footer">
|
||||||
|
@ -325,6 +326,7 @@ export default defineComponent({
|
||||||
objectStorageUseSSL: false,
|
objectStorageUseSSL: false,
|
||||||
objectStorageUseProxy: false,
|
objectStorageUseProxy: false,
|
||||||
objectStorageSetPublicRead: false,
|
objectStorageSetPublicRead: false,
|
||||||
|
objectStorageS3ForcePathStyle: true,
|
||||||
enableTwitterIntegration: false,
|
enableTwitterIntegration: false,
|
||||||
twitterConsumerKey: null,
|
twitterConsumerKey: null,
|
||||||
twitterConsumerSecret: null,
|
twitterConsumerSecret: null,
|
||||||
|
@ -393,6 +395,7 @@ export default defineComponent({
|
||||||
this.objectStorageUseSSL = this.meta.objectStorageUseSSL;
|
this.objectStorageUseSSL = this.meta.objectStorageUseSSL;
|
||||||
this.objectStorageUseProxy = this.meta.objectStorageUseProxy;
|
this.objectStorageUseProxy = this.meta.objectStorageUseProxy;
|
||||||
this.objectStorageSetPublicRead = this.meta.objectStorageSetPublicRead;
|
this.objectStorageSetPublicRead = this.meta.objectStorageSetPublicRead;
|
||||||
|
this.objectStorageS3ForcePathStyle = this.meta.objectStorageS3ForcePathStyle;
|
||||||
this.enableTwitterIntegration = this.meta.enableTwitterIntegration;
|
this.enableTwitterIntegration = this.meta.enableTwitterIntegration;
|
||||||
this.twitterConsumerKey = this.meta.twitterConsumerKey;
|
this.twitterConsumerKey = this.meta.twitterConsumerKey;
|
||||||
this.twitterConsumerSecret = this.meta.twitterConsumerSecret;
|
this.twitterConsumerSecret = this.meta.twitterConsumerSecret;
|
||||||
|
@ -547,6 +550,7 @@ export default defineComponent({
|
||||||
objectStorageUseSSL: this.objectStorageUseSSL,
|
objectStorageUseSSL: this.objectStorageUseSSL,
|
||||||
objectStorageUseProxy: this.objectStorageUseProxy,
|
objectStorageUseProxy: this.objectStorageUseProxy,
|
||||||
objectStorageSetPublicRead: this.objectStorageSetPublicRead,
|
objectStorageSetPublicRead: this.objectStorageSetPublicRead,
|
||||||
|
objectStorageS3ForcePathStyle: this.objectStorageS3ForcePathStyle,
|
||||||
enableTwitterIntegration: this.enableTwitterIntegration,
|
enableTwitterIntegration: this.enableTwitterIntegration,
|
||||||
twitterConsumerKey: this.twitterConsumerKey,
|
twitterConsumerKey: this.twitterConsumerKey,
|
||||||
twitterConsumerSecret: this.twitterConsumerSecret,
|
twitterConsumerSecret: this.twitterConsumerSecret,
|
||||||
|
|
|
@ -399,4 +399,9 @@ export class Meta {
|
||||||
default: false,
|
default: false,
|
||||||
})
|
})
|
||||||
public objectStorageSetPublicRead: boolean;
|
public objectStorageSetPublicRead: boolean;
|
||||||
|
|
||||||
|
@Column('boolean', {
|
||||||
|
default: true,
|
||||||
|
})
|
||||||
|
public objectStorageS3ForcePathStyle: boolean;
|
||||||
}
|
}
|
||||||
|
|
|
@ -438,7 +438,11 @@ export const meta = {
|
||||||
|
|
||||||
objectStorageSetPublicRead: {
|
objectStorageSetPublicRead: {
|
||||||
validator: $.optional.bool
|
validator: $.optional.bool
|
||||||
}
|
},
|
||||||
|
|
||||||
|
objectStorageS3ForcePathStyle: {
|
||||||
|
validator: $.optional.bool
|
||||||
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -713,6 +717,10 @@ export default define(meta, async (ps, me) => {
|
||||||
set.objectStorageSetPublicRead = ps.objectStorageSetPublicRead;
|
set.objectStorageSetPublicRead = ps.objectStorageSetPublicRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (ps.objectStorageS3ForcePathStyle !== undefined) {
|
||||||
|
set.objectStorageS3ForcePathStyle = ps.objectStorageS3ForcePathStyle;
|
||||||
|
}
|
||||||
|
|
||||||
await getConnection().transaction(async transactionalEntityManager => {
|
await getConnection().transaction(async transactionalEntityManager => {
|
||||||
const meta = await transactionalEntityManager.findOne(Meta, {
|
const meta = await transactionalEntityManager.findOne(Meta, {
|
||||||
order: {
|
order: {
|
||||||
|
|
|
@ -205,6 +205,7 @@ export default define(meta, async (ps, me) => {
|
||||||
response.objectStorageUseSSL = instance.objectStorageUseSSL;
|
response.objectStorageUseSSL = instance.objectStorageUseSSL;
|
||||||
response.objectStorageUseProxy = instance.objectStorageUseProxy;
|
response.objectStorageUseProxy = instance.objectStorageUseProxy;
|
||||||
response.objectStorageSetPublicRead = instance.objectStorageSetPublicRead;
|
response.objectStorageSetPublicRead = instance.objectStorageSetPublicRead;
|
||||||
|
response.objectStorageS3ForcePathStyle = instance.objectStorageS3ForcePathStyle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,9 @@ export function getS3(meta: Meta) {
|
||||||
secretAccessKey: meta.objectStorageSecretKey!,
|
secretAccessKey: meta.objectStorageSecretKey!,
|
||||||
region: meta.objectStorageRegion || undefined,
|
region: meta.objectStorageRegion || undefined,
|
||||||
sslEnabled: meta.objectStorageUseSSL,
|
sslEnabled: meta.objectStorageUseSSL,
|
||||||
s3ForcePathStyle: !!meta.objectStorageEndpoint,
|
s3ForcePathStyle: !meta.objectStorageEndpoint // AWS with endPoint omitted
|
||||||
|
? false
|
||||||
|
: meta.objectStorageS3ForcePathStyle,
|
||||||
httpOptions: {
|
httpOptions: {
|
||||||
agent: getAgentByUrl(new URL(u), !meta.objectStorageUseProxy)
|
agent: getAgentByUrl(new URL(u), !meta.objectStorageUseProxy)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue