src: use the plumbed BLACKSMITH_BACKEND_URL if present

This commit is contained in:
Aditya Maru 2024-12-21 12:08:11 -05:00
parent e836937c09
commit 4759d93c12
3 changed files with 7 additions and 5 deletions

2
dist/index.js generated vendored

File diff suppressed because one or more lines are too long

2
dist/index.js.map generated vendored

File diff suppressed because one or more lines are too long

View File

@ -10,9 +10,11 @@ import { Metric, Metric_MetricType } from "@buf/blacksmith_vm-agent.bufbuild_es/
// Configure base axios instance for Blacksmith API. // Configure base axios instance for Blacksmith API.
const createBlacksmithAPIClient = () => { const createBlacksmithAPIClient = () => {
const apiUrl = process.env.BLACKSMITH_ENV?.includes('staging') const apiUrl = process.env.BLACKSMITH_BACKEND_URL || (
? 'https://stagingapi.blacksmith.sh' process.env.BLACKSMITH_ENV?.includes('staging')
: 'https://api.blacksmith.sh'; ? 'https://stagingapi.blacksmith.sh'
: 'https://api.blacksmith.sh'
);
const client = axios.create({ const client = axios.create({
baseURL: apiUrl, baseURL: apiUrl,