Worker

A Worker is a process that runs separately from ConfigHub and communicates with ConfigHub to perform various tasks. There are two main reasons for having a separate process like this. First it allows developers to build custom functionality that can be invoked by ConfigHub's service. Second it allows certain tasks to be performed inside networks and/or using secrets that ConfigHub does not have access to.

There are two main types of work performed by Workers: Function execution and Infrastructure bridging. Functions and Bridges are implemented as self-contained software modules that are then loaded up inside a Worker process where the Worker is responsible for communication between Functions and Bridges and ConfigHub.

When a function is executed from within ConfigHub, ConfigHub is responsible for routing the call to the Worker containing the function implementation and passing the input data to the Function via the Worker. The response from the function is sent back to ConfigHub by the Worker.

There are well-defined APIs for implementing custom Bridges and Functions. The Worker interacts with these APIs and the Worker is responsible for reliable communication with ConfigHub. Bridge and Function implementations do not have to worry about that.

Workers primarily communicate with ConfigHub using a persistent connection initiated by the Worker, which allows for ConfigHub-to-Worker communication when the Worker are behind firewalls.

The BridgeWorker API also currently doubles as a kind of service account, with its own user identity and credentials, a little like an API key that can be exchanged for a standard authentication token. This identity can be used by clients to connect to ConfigHub, including ordinary API clients using ConfigHub's main HTTP API. No active worker connection is necessary in order to use this identity in a client. In the case that no persistent worker connection is needed, ProvidedInfo.IsServerWorker can be set to true. Such a BridgeWorker can still be used to create Targets, with ProviderType OCI or ConfigHub.

For more details about how to run workers, see the guide.