diff --git a/bin/cml/publish.js b/bin/cml/publish.js index 822baf44c..cdc0cc2ed 100644 --- a/bin/cml/publish.js +++ b/bin/cml/publish.js @@ -32,6 +32,11 @@ exports.handler = async (opts) => { exports.builder = (yargs) => yargs.env('CML_PUBLISH').options( kebabcaseKeys({ + url: { + type: 'string', + description: 'Self-Hosted URL', + hidden: true + }, md: { type: 'boolean', description: 'Output in markdown format [title || name](url).' diff --git a/src/utils.js b/src/utils.js index a99f3b9ab..2cb95afe9 100644 --- a/src/utils.js +++ b/src/utils.js @@ -62,8 +62,7 @@ const fetchUploadData = async (opts) => { }; const upload = async (opts) => { - const { path, session } = opts; - const endpoint = 'https://asset.cml.dev'; + const { path, session, url = 'https://asset.cml.dev' } = opts; const { mime, size, data: body } = await fetchUploadData(opts); const filename = path ? PATH.basename(path) : `file.${mime.split('/')[1]}`; @@ -76,7 +75,7 @@ const upload = async (opts) => { if (session) headers['Content-Address-Seed'] = `${session}:${path}`; - 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)