Discovery

Configuration

Config reference, YAML example, and options for Discovery

YAML Configuration Example

config.yaml
extensions:
  discovery:
    enabled: true
    backend: "consul"                # "memory", "consul", "etcd", "mdns", "kubernetes", "eureka"

    service:
      name: "my-service"
      id: ""                         # auto-generated if empty
      version: "1.0.0"
      address: "localhost"
      port: 8080
      tags: ["api", "v1"]
      metadata:
        team: "platform"
      enableAutoDeregister: true

    healthCheck:
      enabled: true
      interval: "10s"
      timeout: "5s"
      deregisterCriticalServiceAfter: "1m"

    watch:
      enabled: false
      services: []
      tags: []

    consul:
      address: "127.0.0.1:8500"

    etcd:
      endpoints:
        - "127.0.0.1:2379"
      dialTimeout: "5s"
      keyPrefix: "/services"

    mdns:
      domain: "local."
      browseTimeout: "3s"
      ttl: 120

    farp:
      enabled: false
      autoRegister: true
      strategy: "push"              # "push", "pull", "hybrid"
      endpoints:
        health: "/health"
        metrics: ""
        openAPI: ""
        asyncAPI: ""
        grpcReflection: ""
        graphQL: ""
      capabilities: []

Programmatic Configuration

ext := discovery.NewExtension(
    discovery.WithBackend("consul"),
    discovery.WithServiceName("my-service"),
    discovery.WithServicePort(8080),
    discovery.WithTags("api", "v1"),
    discovery.WithHealthCheck(true, 10*time.Second),
    discovery.WithFARP(true),
)

Key Config Sections

Service Registration

FieldDefaultDescription
Name""Service name
ID""Service instance ID (auto-generated)
Version""Service version
Address""Service address
Port0Service port
Tags[]Service tags for filtering
Metadata{}Arbitrary key-value metadata
EnableAutoDeregistertrueAuto-deregister on shutdown

Health Check

FieldDefaultDescription
EnabledtrueEnable health checks
Interval10sHealth check interval
Timeout5sHealth check timeout
DeregisterCriticalServiceAfter1mDeregister after critical for this duration

FARP

FieldDefaultDescription
EnabledfalseEnable FARP endpoints
AutoRegistertrueAuto-register FARP manifest
Strategy"push"Registration strategy: push, pull, hybrid
EndpointsAPI endpoint paths for schema discovery
Capabilities[]Advertised capabilities

How is this guide?

On this page