mirror of
https://github.com/hanzoai/bootnode.git
synced 2026-10-25 02:31:30 +00:00
Names the two halves for what they are. The repo already holds both (12407e9 merged bootnode/bootnode into this history); this makes the frontend directory say so, so the layout reads the way the owner describes the system: backend and frontend separate, one repo. git mv throughout — 187 renames, history preserved. Every path reference follows: hanzo.yml build context and dockerfile, compose.yml, compose.prod.yml, start.sh, LLM.md, infra/k8s/web-deployments.yaml, infra/cloud/deploy.sh, and the Dockerfile's own COPY paths. Image and container names (bootnode-web, the -web tag suffix) are deliberately NOT renamed here: those are a deploy contract the App CR and ingress bind to on port 3001, and breaking them is a separate, staged change. Console builds green after the move; the Go tree builds. Co-authored-by: Hanzo Dev <[email protected]>
100 lines
3.1 KiB
TypeScript
100 lines
3.1 KiB
TypeScript
// Docs configuration - fully brand-aware URLs and examples
|
|
// All branding is centralized in lib/brand.ts
|
|
|
|
import { getBrand } from "./brand"
|
|
|
|
// Get current brand configuration
|
|
const brand = getBrand()
|
|
|
|
export const docsConfig = {
|
|
// Brand info
|
|
brandName: brand.name,
|
|
brandTagline: brand.tagline,
|
|
brandDescription: brand.description,
|
|
|
|
// API endpoints - detected from env or derived from brand
|
|
// brand.apiUrl, not `api.${brand.domain}`: that derivation yields
|
|
// api.cloud.pars.network and api.cloud.zoo.network, neither of which
|
|
// exists. The catalog carries the real per-brand origin.
|
|
// Every URL is brand-derived. The NEXT_PUBLIC_* overrides that used to sit
|
|
// in front of these were build-time constants in an image that serves five
|
|
// hosts — setting one would have handed the same dashboard/ws/docs origin to
|
|
// every brand. The brand catalog is the only thing that can be per-host.
|
|
apiUrl: brand.apiUrl,
|
|
dashboardUrl: `https://${brand.domain}`,
|
|
wsUrl: brand.wsUrl,
|
|
zapUrl: `zap://api.${brand.domain}:9999`,
|
|
docsUrl: `https://docs.${brand.domain}`,
|
|
statusUrl: brand.statusUrl,
|
|
|
|
// API key prefix (brand-specific)
|
|
apiKeyPrefix: brand.name.toLowerCase().startsWith("hanzo") ? "hz_"
|
|
: brand.name.toLowerCase().startsWith("lux") ? "lux_"
|
|
: brand.name.toLowerCase().startsWith("zoo") ? "zoo_"
|
|
: "bn_",
|
|
|
|
// Social links
|
|
social: brand.social,
|
|
|
|
// IAM configuration
|
|
iam: brand.iam,
|
|
}
|
|
|
|
// Helper to get full API URL
|
|
export function getApiUrl(path: string = ""): string {
|
|
return `${docsConfig.apiUrl}${path}`
|
|
}
|
|
|
|
// Helper to get dashboard URL
|
|
export function getDashboardUrl(path: string = ""): string {
|
|
return `${docsConfig.dashboardUrl}${path}`
|
|
}
|
|
|
|
// Example curl command with brand-specific URL
|
|
export function exampleCurl(method: string, params: string = "[]"): string {
|
|
return `curl -X POST ${docsConfig.apiUrl}/v1/rpc/ethereum/mainnet \\
|
|
-H "Content-Type: application/json" \\
|
|
-H "X-API-Key: ${docsConfig.apiKeyPrefix}YOUR_API_KEY" \\
|
|
-d '{
|
|
"jsonrpc": "2.0",
|
|
"id": 1,
|
|
"method": "${method}",
|
|
"params": ${params}
|
|
}'`
|
|
}
|
|
|
|
// Example code snippets with brand-specific imports
|
|
export function exampleTypescript(method: string): string {
|
|
const sdkName = docsConfig.brandName.toLowerCase().replace(/\s+/g, "-")
|
|
return `import { createClient } from "@${sdkName}/sdk"
|
|
|
|
const client = createClient({
|
|
apiKey: "${docsConfig.apiKeyPrefix}YOUR_API_KEY",
|
|
})
|
|
|
|
const result = await client.rpc.${method}()
|
|
console.log(result)`
|
|
}
|
|
|
|
export function examplePython(method: string): string {
|
|
const sdkName = docsConfig.brandName.toLowerCase().replace(/\s+/g, "_")
|
|
return `from ${sdkName} import Client
|
|
|
|
client = Client(api_key="${docsConfig.apiKeyPrefix}YOUR_API_KEY")
|
|
result = client.rpc.${method}()
|
|
print(result)`
|
|
}
|
|
|
|
// Example ZAP client snippet
|
|
export function exampleZap(): string {
|
|
return `from hanzo_zap import Client
|
|
|
|
async with Client.connect("${docsConfig.zapUrl}") as client:
|
|
server = await client.init({"name": "my-agent", "version": "1.0"})
|
|
result = await client.call_tool("rpc_call", {
|
|
"chain": "ethereum",
|
|
"method": "eth_blockNumber"
|
|
})
|
|
print(f"Block: {int(result['result'], 16)}")`
|
|
}
|