MCPcopy Index your code
hub / github.com/PaystackOSS/paystack-mcp-server / getConfig

Function getConfig

src/config.ts:7–32  ·  view source on GitHub ↗
(cliApiKey?: string)

Source from the content-addressed store, hash-verified

5
6// Get configuration with optional CLI API key
7export function getConfig(cliApiKey?: string) {
8 const apiKey = cliApiKey || process.env.PAYSTACK_TEST_SECRET_KEY;
9
10 if (!apiKey) {
11 console.error('Error: PAYSTACK_TEST_SECRET_KEY is required');
12 process.exit(1);
13 }
14
15 if (!apiKey.startsWith('sk_test_')) {
16 console.error(
17 'Error: PAYSTACK_TEST_SECRET_KEY must begin with "sk_test_". No live keys allowed.',
18 );
19 process.exit(1);
20 }
21
22 if (apiKey.length < 30) {
23 console.error('Error: PAYSTACK_TEST_SECRET_KEY appears to be too short');
24 process.exit(1);
25 }
26
27 return {
28 PAYSTACK_TEST_SECRET_KEY: apiKey,
29 NODE_ENV: (process.env.NODE_ENV as 'development' | 'production' | 'test') || 'development',
30 LOG_LEVEL: (process.env.LOG_LEVEL as 'debug' | 'info' | 'warn' | 'error') || 'info',
31 };
32}
33
34// Paystack API configuration factory
35export function createPaystackConfig(cliApiKey?: string) {

Callers 2

createPaystackConfigFunction · 0.85
createLoggerFunction · 0.85

Calls 1

errorMethod · 0.80

Tested by

no test coverage detected