Skip to main content
Version: v0.2.0

CLI Configuration Reference

Every protoconf component is configured from a protobuf message, which means the same setting is always available three ways: as a command-line flag, as an environment variable, and as a field in a configuration file.

Precedence

Since v0.2.0 all five components — agent, serve, compile, insert and mutate — resolve their configuration in the same order:

flags > environment variables > config file > proto defaults

A flag beats everything. An environment variable beats a config file. A config file only fills in what nothing else set.

Changed in v0.2.0

In v0.1.7, protoconf agent let a -config-file value override PROTOCONF_AGENT_* environment variables. It no longer does. See Upgrading from v0.1.7.

Config files

Pass a config file with -config-file. The agent accepts JSON, Jsonnet, YAML and binary protobuf; the other components accept JSON, YAML and binary protobuf. Keys are the flag names:

{
"grpc-address": "0.0.0.0:4300",
"http-address": "0.0.0.0:4380",
"store": "etcd",
"store-address": ["etcd-0:2379", "etcd-1:2379"],
"prefix": "protoconf",
"log-level": "INFO"
}
protoconf agent -config-file agent.json

-config-file can be repeated. Later files win over earlier ones — including for message-typed fields such as tls-config and store-tls, and for repeated fields such as store-address.

# override.json's TLS material wins.
protoconf agent -config-file base.json -config-file override.json

Environment variables

Each component reads its own prefix:

CommandPrefix
protoconf agentPROTOCONF_AGENT_
protoconf servePROTOCONF_SERVER_
protoconf compilePROTOCONF_COMPILER_
protoconf insertPROTOCONF_INSERTER_
protoconf mutatePROTOCONF_MUTATE_
protoconf modPROTOCONF_MOD_

The rest of the name comes from the underlying protobuf field name, uppercased. That is usually the same as the flag name with dashes turned into underscores, but not always — protoconf agent -dev is PROTOCONF_AGENT_DEV_ROOT, for instance. The tables below list both spellings side by side, so you never have to guess.

protoconf agent

Serves configs from a key-value store to subscribers over gRPC.

protoconf agent -store etcd -store-address etcd:2379 -prefix myproject
FlagEnvironment variableDefaultDescription
-grpc-addressPROTOCONF_AGENT_GRPC_ADDRESS:4300Address to bind the gRPC listener
-http-addressPROTOCONF_AGENT_HTTP_ADDRESS:4380Address to bind the admin HTTP listener (/metrics, /debug/pprof, /v1/config/...)
-devPROTOCONF_AGENT_DEV_ROOTDevelopment mode: watch a local protoconf directory instead of a key-value store
-storePROTOCONF_AGENT_STOREconsulconsul, etcd, zookeeper, file or configmaps
-store-addressPROTOCONF_AGENT_SERVERSper storeKey-value store addresses (repeatable)
-prefixPROTOCONF_AGENT_PREFIXKey prefix inside the store
-namespacePROTOCONF_AGENT_NAMESPACEKubernetes namespace, for the configmaps store
-insecurePROTOCONF_AGENT_INSECUREfalseSkip the gRPC server TLS configuration
-tls-config-cert-file, -tls-config-key-file, -tls-config-ca-fileTLS material for the gRPC server (-tls-config-cert-text and friends take the material inline)
-store-tls-cert-file, -store-tls-key-file, -store-tls-ca-fileTLS material for the connection to the store
-enable-rolloutPROTOCONF_AGENT_ENABLE_ROLLOUTfalseResolve staged rollouts (see Staged Rollouts)
-channelNamePROTOCONF_AGENT_CHANNEL_NAMERollout channel this agent belongs to
-enable-otelPROTOCONF_AGENT_ENABLE_OTELfalseExport traces and metrics over OTLP/gRPC
-log-levelPROTOCONF_AGENT_LOG_LEVELINFODEBUG, INFO, WARN or ERROR
-log-as-jsonPROTOCONF_AGENT_LOG_AS_JSONfalseEmit logs as JSON
-log-sourcePROTOCONF_AGENT_LOG_SOURCEfalseInclude the source location in logs

When -enable-rollout is set, the agent identifies itself by its hostname; that identity is what percentile-based rollout stages hash on.

protoconf serve

Runs the mutation server.

FlagEnvironment variableDefaultDescription
-grpc-addressPROTOCONF_SERVER_GRPC_ADDRESS:4301Address to bind the gRPC listener
-prePROTOCONF_SERVER_PRE_MUTATION_SCRIPTPre-mutation script
-postPROTOCONF_SERVER_POST_MUTATION_SCRIPTPost-mutation script
-tls-certPROTOCONF_SERVER_TLS_CERTTLS certificate file
-tls-keyPROTOCONF_SERVER_TLS_KEYTLS key file
-tls-caPROTOCONF_SERVER_TLS_CACA file; setting it enables client certificate verification
-auth-tokenPROTOCONF_SERVER_AUTH_TOKENBearer token required from mutation clients; auth is disabled when empty
-enable-otelPROTOCONF_SERVER_ENABLE_OTELfalseExport traces and metrics over OTLP/gRPC

protoconf compile

Compiles Starlark configs into materialized protobuf.

protoconf compile . myproject/server_config
FlagEnvironment variableDefaultDescription
-VPROTOCONF_COMPILER_VERBOSE_LOGGINGfalseVerbose logging
-replPROTOCONF_COMPILER_REPLfalseInteractive REPL
-process-templatesPROTOCONF_COMPILER_PROCESS_TEMPLATESfalseProcess .template files before compiling
-compiler-addressPROTOCONF_COMPILER_COMPILER_ADDRESSCompile through a remote compiler service instead of locally
-cpuprofilePROTOCONF_COMPILER_CPUPROFILEWrite CPU profiling output to a file
-memprofilePROTOCONF_COMPILER_MEMPROFILEWrite memory profiling output to a file

protoconf insert

Writes materialized configs into a key-value store.

FlagEnvironment variableDefaultDescription
-storePROTOCONF_INSERTER_STOREconsulconsul, etcd, zookeeper or configmaps
-store-addressPROTOCONF_INSERTER_STORE_ADDRESSper storeKey-value store addresses (repeatable)
-prefixPROTOCONF_INSERTER_PREFIXKey prefix inside the store
-namespacePROTOCONF_INSERTER_NAMESPACEKubernetes namespace, for the configmaps store
-dPROTOCONF_INSERTER_DELETEfalseDelete the given configs instead of inserting them

protoconf mutate

Sends a mutation to the mutation server.

FlagEnvironment variableDefaultDescription
-rootPROTOCONF_MUTATE_PROTOCONF_ROOT./srcRoot of the protoconf sources
-protoPROTOCONF_MUTATE_PROTO_FILEPath to the proto file
-msgPROTOCONF_MUTATE_PROTO_MSGMessage name inside the proto file
-addrPROTOCONF_MUTATE_SERVER_ADDRESSlocalhost:4301Mutation server address
-pathPROTOCONF_MUTATE_CONFIG_PATHPath to write the config to
-fieldPROTOCONF_MUTATE_FIELDSkey=value field to set (repeatable)
-metadataPROTOCONF_MUTATE_METADATA_STRMetadata string passed to the pre/post scripts
-tls-certPROTOCONF_MUTATE_TLS_CERTClient TLS certificate file
-tls-keyPROTOCONF_MUTATE_TLS_KEYClient TLS key file
-tls-caPROTOCONF_MUTATE_TLS_CACA file used to verify the server
-insecurePROTOCONF_MUTATE_INSECURE_TLSfalseConnect without TLS

protoconf mod

Manages remote proto module dependencies. See Remote Modules.

CommandDescription
protoconf mod initResolve CONFIGSPACE into protoconf.lock
protoconf mod syncDownload and cache everything protoconf.lock pins
protoconf mod tidyinit followed by sync
FlagEnvironment variableDefault
-protoconfPathPROTOCONF_MOD_PROTOCONF_PATHthe current directory
-cacheDirPROTOCONF_MOD_CACHE_DIR.protoconf_cache
-lockFilePROTOCONF_MOD_LOCK_FILEprotoconf.lock

protoconf devserver

Runs the agent, the compiler service and the mutation server in one process, with a gRPC web UI on http://localhost:4300. It takes the protoconf root as its only argument and is meant for local development, not production.

protoconf devserver .

protoconf fmt

Formats Starlark sources. See Formatting Starlark Sources.

FlagDescription
-wWrite the result back to the source file instead of stdout
-dPrint diffs instead of rewriting files
-lList the files whose formatting differs