-
Notifications
You must be signed in to change notification settings - Fork 472
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
116 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
export function getBaseUrl(domain: string) { | ||
let url = domain | ||
if (!domain.startsWith('http')) { | ||
const local = domain === 'localhost' || domain.startsWith('127.0.0.') | ||
url = `http${local ? '' : 's'}://${domain}` | ||
} | ||
|
||
const parsedUrl = new URL(url) | ||
|
||
return parsedUrl.toString() | ||
} | ||
|
||
export function getBillingUrl(domain: string) { | ||
let url = domain | ||
const local = domain === 'localhost' || domain.startsWith('127.0.0.') | ||
|
||
if (!domain.startsWith('http')) { | ||
url = `http${local ? '' : 's'}://${domain}` | ||
} | ||
|
||
const parsedUrl = new URL(url) | ||
if (!local) { | ||
parsedUrl.hostname = `billing.${parsedUrl.hostname}` | ||
} | ||
|
||
return parsedUrl.toString() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.