PusherServer.Config (pusher_server v0.1.0)

Copy Markdown View Source

Per-instance configuration.

Resolves explicit options first (passed to PusherServer.start_link/1), falling back to environment variables for anything omitted — the same variables the standalone release reads. This is what lets the exact same code run either as a hex dependency embedded in your own supervision tree (config passed explicitly) or as a standalone release configured purely by env vars, with zero code differences.

Options / environment variables

OptionEnv varDefault
:app_keyPUSHER_APP_KEY"app-key"
:app_secretPUSHER_APP_SECRET"app-secret" (public; a warning is logged, always set your own)
:app_idPUSHER_APP_ID"app-id"
:portPORT6001
:webhook_urlPUSHER_WEBHOOK_URLnone
:client_messages_enabledPUSHER_ENABLE_CLIENT_MESSAGEStrue
:redis_urlPUSHER_REDIS_URLnone (single node)
:redis_opts—[] (extra Redix options, e.g. ssl: true)
:webhook_retriesPUSHER_WEBHOOK_RETRIES3 (retries after the first attempt; 0 disables)
:webhook_retry_base_ms—1000 (delay doubles on each retry)
:rest_rate_limitPUSHER_REST_RATE_LIMITnone (max REST API requests per second, per instance)
:client_event_rate_limitPUSHER_CLIENT_EVENT_RATE_LIMITnone (max client events per second, per connection)
:max_connectionsPUSHER_MAX_CONNECTIONSnone (max WebSocket connections on this node)
:batch_limitPUSHER_BATCH_LIMIT10 (max events per batch_events request)
:metricsPUSHER_METRICSfalse (serve Prometheus metrics at GET /metrics)
:metrics_tokenPUSHER_METRICS_TOKENnone (if set, /metrics requires Authorization: Bearer <token>)

Setting :redis_url switches the instance to the Redis backend so several nodes can share channels, presence and broadcasts. Without it, the instance runs fully in-memory and needs nothing but this library.