Skip to content

Commit 4f7a466

Browse files
committed
url/utils default
1 parent 650f23d commit 4f7a466

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

bin/cml/publish.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,9 @@ exports.handler = async (opts) => {
3232
exports.builder = (yargs) =>
3333
yargs.env('CML_PUBLISH').options(
3434
kebabcaseKeys({
35-
domain: {
35+
url: {
3636
type: 'string',
37-
description: 'Self-Hosted domain',
38-
default: 'asset.cml.dev',
37+
description: 'Self-Hosted URL',
3938
hidden: true
4039
},
4140
md: {

src/utils.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ const fetchUploadData = async (opts) => {
6161
};
6262

6363
const upload = async (opts) => {
64-
const { path, domain } = opts;
65-
const endpoint = `https://${domain}`;
64+
const { path, url = 'https://asset.cml.dev' } = opts;
6665

6766
const { mime, size, data: body } = await fetchUploadData(opts);
6867
const filename = path ? PATH.basename(path) : `file.${mime.split('/')[1]}`;
@@ -73,7 +72,7 @@ const upload = async (opts) => {
7372
'Content-Disposition': `inline; filename="${filename}"`
7473
};
7574

76-
const response = await fetch(endpoint, { method: 'POST', headers, body });
75+
const response = await fetch(url, { method: 'POST', headers, body });
7776
const uri = await response.text();
7877

7978
if (!uri)

0 commit comments

Comments
 (0)