Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement custom cml publish Domain #1075

Merged
merged 3 commits into from
Jun 23, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions bin/cml/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ exports.handler = async (opts) => {
exports.builder = (yargs) =>
yargs.env('CML_PUBLISH').options(
kebabcaseKeys({
domain: {
type: 'string',
description: 'Self-Hosted domain',
default: 'asset.cml.dev',
hidden: true
},
md: {
type: 'boolean',
description: 'Output in markdown format [title || name](url).'
Expand Down
4 changes: 2 additions & 2 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ const fetchUploadData = async (opts) => {
};

const upload = async (opts) => {
const { path } = opts;
const endpoint = 'https://asset.cml.dev';
const { path, domain } = opts;
const endpoint = `https://${domain}`;
dacbd marked this conversation as resolved.
Show resolved Hide resolved

const { mime, size, data: body } = await fetchUploadData(opts);
const filename = path ? PATH.basename(path) : `file.${mime.split('/')[1]}`;
Expand Down