Skip to content

Environment Variables

BJ Neilsen edited this page Feb 20, 2014 · 6 revisions

We utilize Environment Variables quite extensively to influence or define the behavior of certain aspects of the library. Here is a list of those environment variables and their uses. With a few exceptions (see below), all of the variables are only checked for presence, their value is meaningless and we often simply set them to 1.

Compile-time Variables

PB_NO_TAG_WARNINGS=(any value)

When compiling your definitions we can check to see if a message or enum has tag number gaps, and warn you when you do. If you don't care about these warnings you can suppress them with this option.

PB_NO_CLEAN=(any value)

Compiling with the rake task will automatically force a clean before compiling. Disable this behavior by passing PB_NO_CLEAN=1.

PB_FORCE_CLEAN=(any value)

Cleaning compiled code with the rake task will prompt you to confirm the clean. Disable this behavior by passing PB_FORCE_CLEAN=1. Note that the compile task will automatically set this env variable unless you pass the PB_NO_CLEAN=1 variable.


Runtime Variables

The following variables affect how the library operates within a running process or application.

PB_CLIENT_RETRIES=(NUMBER > 0)

Note: This option only applies to clients running the ZMQ client type.

Specify the number of times a client RPC call should attempt to successfully send a request to a service. Any timeout value specified in the request will wait the entire timeout before beginning a new request. For instance, if your timeout is 5 seconds and your PB_CLIENT_RETRIES=3, it could potentially take 15 seconds to get a response from the server if the server is having issues responding. See the ZMQ Guide on the Lazy Pirate Pattern for more information.

PB_CLIENT_TYPE=( socket | zmq)

Set the connector transport type to be used for all client requests. Current options socket (default) and zmq (case does not matter). Whatever value you set here, you should mirror with PB_SERVER_TYPE on the server side, otherwise your requests will not work correctly.

PB_IGNORE_DEPRECATIONS=(any value)

The protobuf compiler respects field deprecation settings. If you have any fields that are deprecated, a message will be printed any time a deprecated field is assigned or read which can aid you in getting away from deprecated field usage. You can suppress this warning behavior with this option.

PB_NO_NETWORKING=(any value)

This variable is used internally when protoc invokes the generator to stop any networking code from being required. It's an optimization for that process but may be useful to you and could be used during runtime.

PB_RPC_PING_PORT=(NUMBER)

Note: This option only applies to clients running the ZMQ client type.

Set the port number we expect the server host to be bound to for client processes. When set it enables the client process to check for a host's "aliveness" before attempting to make the request. This is useful in an environment where you have redundant service machines and expect any service to go offline at any time. If not given, this behavior is not enabled and services are assumed to be running.

PB_SERVER_TYPE=(socket | zmq)

Set the transport type the server should use when handling service requests. Note this value should mirror whatever you have set on the client process with PB_CLIENT_TYPE. See PB_CLIENT_TYPE for more info. socket is the default.

PB_WORKERS_ONLY=(any value)

Note: This option only applies to servers running the ZMQ server type.

Instructs the server process not to start a broker as one has already been started for the given server. This allows you to run multiple worker processes independent of the main server process that also runs the broker and binds to the outer interface. The broker process does not have to be running on the workers' machine.