Files
insights-js/playground/flags/remote-config-example.js
zeekay e43ab1afe7 chore: rename all PostHog references to Insights/Hanzo
Bulk rename across 989 files:
- Package names: posthog-js → @hanzo/insights, posthog-node → @hanzo/insights-node, etc.
- Repository URLs: posthog/posthog-js → hanzoai/insights-js
- Brand names: PostHog → Insights
- File renames: 259 reference JSON files, source files, workflow files
- Directory rename: eslint-plugin-posthog-js → eslint-plugin-insights

Remaining: 8 refs to @posthog/rrweb-* (real npm deps, need fork+publish)
2026-03-06 01:41:12 -08:00

44 lines
1.3 KiB
JavaScript

#!/usr/bin/env node
/* eslint-disable @typescript-eslint/no-require-imports, no-undef, no-console */
/**
* Simple test script for Insights remote config endpoint.
*/
const { Insights } = require('../../packages/node/lib/node')
// Initialize Insights client
const insights = new Insights('phc_...', {
personalApiKey: 'phx_...', // or 'phx_...'
host: 'http://localhost:8000', // or 'https://us.insights.com'
debug: true,
})
async function testRemoteConfig() {
console.log('Testing remote config endpoint...')
// Test feature flag key - replace with an actual flag key from your project
const flagKey = 'unencrypted-remote-config-setting'
try {
// Get remote config payload
const payload = await insights.getRemoteConfigPayload(flagKey)
console.log(`✅ Success! Remote config payload for '${flagKey}':`, payload)
} catch (error) {
console.error(`❌ Error getting remote config:`, error.message)
} finally {
// Clean shutdown
await insights.shutdown()
}
}
// Handle uncaught errors gracefully
process.on('unhandledRejection', (reason, promise) => {
console.error('Unhandled Rejection at:', promise, 'reason:', reason)
process.exit(1)
})
// Run the test
if (require.main === module) {
testRemoteConfig()
}