Documentation ¶
Overview ¶
Package exec implements configuration and secret-sharing between parent and child processes via anoymous pipes. Anonymous pipes are used since they are the most secure communication channel available.
Once a parent starts a child process it can use WaitForReady to wait for the child to reach its 'Ready' state. Operations are provided to wait for the child to terminate, and to terminate the child, cleaning up any state associated with it.
A child process uses the GetChildHandle function to complete the initial authentication handshake. The child must call SetReady to indicate that it is fully initialized and ready for whatever purpose it is intended to fulfill. This handshake is referred as the 'exec protocol'.
Index ¶
Constants ¶
const V23_EXEC_CONFIG = "V23_EXEC_CONFIG" //nolint:golint
The V23_EXEC_CONFIG environment variable is used to share a base64 encoded JSON dictionary containing an instance of Config between a parent and child process.
Variables ¶
This section is empty.
Functions ¶
func DecodeFromEnvVar ¶
DecodeFromEnvVar decodes a base64 encoded JSON representation into the supplied config. See EncodeForEnvVar.
func EncodeForEnvVar ¶
EncodeForEnvVar encodes the supplued config using JSON and base64 so that it can be passed as a value for an environment variable. JSON is used to allow for the greatest level of interoperability.
Types ¶
type Config ¶
type Config interface { // Set sets the value for the key. If the key already exists in the // config, its value is overwritten. Set(key, value string) // Get returns the value for the key. If the key doesn't exist // in the config, Get returns an error. Get(key string) (string, error) // Clear removes the specified key from the config. Clear(key string) // Serialize serializes the config to a string. Serialize() (string, error) // MergeFrom deserializes config information from a string created using // Serialize(), and merges this information into the config, updating // values for keys that already exist and creating new key-value pairs // for keys that don't. MergeFrom(string) error // Dump returns the config information as a map from ket to value. Dump() map[string]string }
Config defines a simple key-value configuration. Keys and values are strings, and a key can have exactly one value. The client is responsible for encoding structured values, or multiple values, in the provided string.
Config data can come from several sources: - passed from parent process to child process through pipe; - using environment variables or flags; - via the neighborhood-based config service; - by RPCs using the Config idl; - manually, by calling the Set method.
This interface makes no assumptions about the source of the configuration, but provides a unified API for accessing it.
func ReadConfigFromOSEnv ¶
ReadConfigFromOSEnv deserializes a Config from the environment variable V23_EXEC_CONFIG and returns that Config.