Skip to content

Commit

Permalink
url/utils default
Browse files Browse the repository at this point in the history
  • Loading branch information
dacbd committed Jun 23, 2022
1 parent 650f23d commit 4f7a466
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions bin/cml/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,9 @@ exports.handler = async (opts) => {
exports.builder = (yargs) =>
yargs.env('CML_PUBLISH').options(
kebabcaseKeys({
domain: {
url: {
type: 'string',
description: 'Self-Hosted domain',
default: 'asset.cml.dev',
description: 'Self-Hosted URL',
hidden: true
},
md: {
Expand Down
5 changes: 2 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ const fetchUploadData = async (opts) => {
};

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

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

const response = await fetch(endpoint, { method: 'POST', headers, body });
const response = await fetch(url, { method: 'POST', headers, body });
const uri = await response.text();

if (!uri)
Expand Down

1 comment on commit 4f7a466

@github-actions

This comment was marked as duplicate.

Please sign in to comment.