Skip to main content

Configuration

const client = new MineTech({
apiKey: process.env.MINETECH_API_KEY!,

// Required when the key enforces signing (default for live keys).
signingSecret: process.env.MINETECH_SIGNING_SECRET,

// Defaults to the URL implied by the key prefix.
baseUrl: 'http://localhost:4001',

timeoutMs: 30_000, // per attempt
maxRetries: 2,
maxRetryDelayMs: 20_000,

defaultHeaders: { 'x-tracing-id': traceId },

onRequest: ({ method, path, attempt }) => log.debug({ method, path, attempt }),
onResponse: ({ status, durationMs }) => metrics.timing('minetech', durationMs),
onRetry: ({ attempt, delayMs, error }) => log.warn({ attempt, delayMs, error }),
});

Environment inference

The base URL comes from the key prefix, so a test key cannot reach production:

Prefixclient.apiEnvironmentBase URL
mt_live_productionhttps://api.minetech.rw
mt_test_sandboxhttps://sandbox.api.minetech.rw
client.apiEnvironment  // 'production' | 'sandbox' | 'development'
client.baseUrl
client.version

client.environment is the environmental-monitoring namespace, not the deployment environment — hence apiEnvironment for the latter.

Observability

The three hooks are the intended integration point for logging and metrics; the SDK never writes to console itself.