Add --url flag to ccc-client and ccc-queue

Overrides CONDUIT_URL env var. Resolved through load_client_config and
threaded into create_conduit_client as base_url parameter.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-07 21:20:59 +00:00
parent 0d1e25019e
commit 62d2480cd4
5 changed files with 32 additions and 23 deletions

View File

@@ -7,11 +7,9 @@
import { sign_request } from './auth.mjs';
import { load_client_config, get_remaining } from './config.mjs';
const BASE_URL = process.env.CONDUIT_URL || 'http://localhost:3015';
async function call_action(payload, username, secret) {
async function call_action(payload, username, secret, url) {
const body_string = JSON.stringify(payload);
const res = await fetch(`${BASE_URL}/action`, {
const res = await fetch(`${url}/action`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', ...sign_request(secret, username, body_string) },
body: body_string,
@@ -21,7 +19,7 @@ async function call_action(payload, username, secret) {
}
async function main() {
const { username, secret } = load_client_config(process.argv);
const { username, secret, url } = load_client_config(process.argv);
const remaining = get_remaining(process.argv);
if (!remaining.length) {
@@ -37,7 +35,7 @@ async function main() {
process.exit(1);
}
const { status, body } = await call_action(payload, username, secret);
const { status, body } = await call_action(payload, username, secret, url);
console.log(JSON.stringify(body, null, 2));
process.exit(status >= 400 ? 1 : 0);
}