Skip to content

Commit

Permalink
fix auto domain
Browse files Browse the repository at this point in the history
  • Loading branch information
rsonghuster committed Sep 4, 2024
1 parent 01da2af commit 774ada3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/impl/custom_domain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ export class CustomDomain {
if (!this.isAutoDomain()) {
return;
}
const autoDomainName = this.getAutoDomainName();
let functionName = this.getProps()['routeConfig']['routes'][0]['functionName'];
const { autoDomainName, functionName } = this.getAutoDomainName();
const userId = this.credentials.AccountID;
const isResolve = await resolveCname(
autoDomainName,
Expand Down Expand Up @@ -78,12 +77,14 @@ export class CustomDomain {
}

private getAutoDomainName() {
const logger = GLogger.getLogger();
// 取第一个 path 中的 functionName
let functionName = this.getProps()['routeConfig']['routes'][0]['functionName'];
const userId = this.credentials.AccountID;
functionName = functionName.replace(/_/g, '-').toLowerCase();
let autoDomainName = `${functionName}.fcv3.${userId}.${this.region}.fc.devsapp.net`;
return autoDomainName;
logger.debug(`getAutoDomainName = ${autoDomainName}`);
return { autoDomainName, functionName };
}

public async cnameCheck(): Promise<boolean> {
Expand Down

0 comments on commit 774ada3

Please sign in to comment.