Commit 330faac5 authored by nanahira's avatar nanahira

add cdnUrLCn

parent 955068fb
Pipeline #39492 passed with stages
in 3 minutes and 42 seconds
......@@ -41,6 +41,7 @@ export class S3Service extends ConsoleLogger {
public readonly cdnUrl =
this.getConfig('S3_CDN_URL') || `${this.getConfig('S3_ENDPOINT')}/${this.bucket}${this.prefix ? `/${this.prefix}` : ''}`;
public readonly cdnUrlOversize = this.getConfig('S3_CDN_URL_OVERSIZE') || this.cdnUrl;
public readonly cdNUrlCn = this.getConfig('S3_CDN_URL_CN') || this.cdnUrl;
private readonly s3Config: S3ClientConfig = {
credentials: {
accessKeyId: this.getConfig('S3_KEY'),
......
......@@ -16,18 +16,17 @@ import { ChnrouteService } from '../chnroute/chnroute.service';
@Injectable()
export class UpdateService extends ConsoleLogger {
private readonly cdnUrl: string;
private readonly cdnUrlOversize: string;
private readonly cdnUrl = this.packageS3.cdnUrl;
private readonly cdnUrlOversize = this.packageS3.cdnUrlOversize;
private readonly cdNUrlCn = this.packageS3.cdNUrlCn;
constructor(
@InjectConnection('app')
private db: Connection,
packageS3: PackageS3Service,
private packageS3: PackageS3Service,
private mirror: MirrorService,
private chnroute: ChnrouteService
) {
super('update');
this.cdnUrl = packageS3.cdnUrl;
this.cdnUrlOversize = packageS3.cdnUrlOversize;
}
async getAppsJson() {
......@@ -146,8 +145,8 @@ export class UpdateService extends ConsoleLogger {
private async prepareUrl(archives: Archive[], ip: string) {
await this.mirror.lookForArchivesMirror(archives, ip);
// const isChina = this.chnroute.isChina(ip);
archives.forEach((a) => a.fillUrl(this.cdnUrl, this.cdnUrlOversize, false));
const isChina = this.chnroute.isChina(ip);
archives.forEach((a) => a.fillUrl(isChina ? this.cdNUrlCn : this.cdnUrl, this.cdnUrlOversize, false));
return archives;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment