﻿# cyoda platform clock configuration

The platform clock is the time cyoda records as business time: entity and audit dates, transition times and scheduled due times. By default it is the real…

<em>cyoda-go version <a href="https://github.com/Cyoda/cyoda-go/releases/tag/v0.9.0">0.9.0</a></em>

# config.clock

## NAME

config.clock — turn on the controllable platform clock, a test feature for moving business time.

## DESCRIPTION

The platform clock is the time cyoda records as business time: entity and audit dates, transition times and scheduled due times. By default it is the real clock and cannot be changed.

- `CYODA_CLOCK_CONTROL_ENABLED` (bool, default: `false`) — build a controllable clock, give it to the storage backend and to everything that reads business time, and accept `POST /platform/clock`. With `false`, `POST /platform/clock` answers `403 CLOCK_CONTROL_DISABLED` and `GET /platform/clock` answers real time at rate 1.

This is a test feature, not for production; startup logs a WARN when it is on. The clock is instance-wide: one setting affects every tenant. Changing it needs a platform operator; in mock IAM mode the one mock principal is an admin, and any admin passes as platform operator. Use the same value on every node of a cluster: a change is pushed to every node and answers only once every node holds it (`503 CLOCK_NOT_CONFIRMED` otherwise); a node that joins takes the setting from its peers; and the nodes need synchronised real clocks. A node that starts with no peer holding a setting starts on real time, and startup fails if the store holds times more than 1 s later than real time.

## SEE ALSO

- config
- config.auth
- config.cluster
- run

## See also

- [`cyoda help config`](/help/config/) — Environment variables beat default values. The `_FILE` suffix variant takes precedence over the plain variable when both are set — for example, `CYODA_POSTGRES_URL_FILE=/etc/secrets/db-url` wins over `CYODA_POSTGRES_URL`. There are no command-line flags for configuration values; env vars are the sole configuration surface.
- [`cyoda help config auth`](/help/config/auth/) — config.auth — IAM mode, JWT settings, identifier rules, HMAC secret, IAM features and signing-key rotation.
- [`cyoda help config cluster`](/help/config/cluster/) — - `CYODA_CLUSTER_ENABLED` (bool, default: `false`) — enable multi-node clustering.
- `CYODA_NODE_ID` (string, default: unset) — unique node identifier; required when `CYODA_CLUSTER_ENABLED=true`; any non-empty string is accepted. It must be distinct on every node: a hand-over between nodes is sealed for the node it is sent to, by this id, so two nodes sharing one id can open each other's (see the `cluster` help topic, `DISPATCH REPLAY PROTECTION`). A node that finds its id already held by a live node of the cluster keeps trying for the whole of `CYODA_STARTUP_TIMEOUT` and refuses to start if the id is still held when that budget runs out, naming this setting, the address the id was found at and the seed it was learned from; the node already holding it keeps serving. The retrying is what a crash needs: a node that did not leave gracefully and comes back at another address finds its peers still holding the record of its previous life, and nothing distinguishes that record from another node's — so the first attempts are refused, and the node starts on the attempt made after its peers have reaped the record, usually a few seconds later. The check runs only while a node is starting, and it runs there twice over: on the join exchange with a seed, and on the membership gossip that follows it, which is what two nodes starting at the same instant have instead of an exchange. It does **not** run afterwards. Once a node is serving, an id claimed from a second address is logged at ERROR, once per address, and nothing else happens: both nodes keep serving under the one id, and each can open the other's hand-overs. Two clusters that each started healthily under overlapping ids and only later meet — a network policy opened, a namespace split joined up, a partition healed — are exactly that case, and so is a node started with no seeds that is later given some. Watch for the ERROR line, fix the id and restart the node that has the wrong one. Together with `CYODA_NODE_ADDR` and `CYODA_GRPC_NODE_ADDR` it must fit the 512-byte gossip metadata (406 bytes for the three values together; 106 bytes are framing, the longest list version and the longest node state); a node whose identity does not fit refuses to start.
- `CYODA_NODE_ADDR` (string, default: `http://localhost:8080`) — this node's HTTP base URL; must include scheme (`http://` or `https://`). Peers proxy requests to it, so `CYODA_HTTP_BIND_ADDRESS` must be an address they can reach (`0.0.0.0` on a multi-host cluster; the default `127.0.0.1` serves only nodes on the same host).
- `CYODA_GRPC_NODE_ADDR` (string, default: unset) — this node's gRPC endpoint advertised to peers (`host:port`, no scheme). When set, peers dial this address for cross-node gRPC callback forwarding. When unset, peers derive the gRPC address from this node's HTTP host plus their own `CYODA_GRPC_PORT` (uniform-deployment default). Either way, `CYODA_GRPC_BIND_ADDRESS` must be an address peers can reach.
- `CYODA_GOSSIP_ADDR` (string, default: `:7946`) — gossip protocol listen address; format `[host]:port` — parsed via `net.SplitHostPort`; invalid format causes startup failure.
- `CYODA_GOSSIP_STABILITY_WINDOW` (duration, default: `2s`) — gossip stability window.
- `CYODA_SEED_NODES` (string, default: empty) — comma-separated list of seed node addresses (e.g., `node1.example.com:7946,node2.example.com:7946`); empty means single-node or seed-discovery handled externally.
- `CYODA_HMAC_SECRET` (string, default: unset) — hex-encoded HMAC secret for inter-node dispatch authentication; required when `CYODA_CLUSTER_ENABLED=true`. Supports `_FILE` suffix. Single root secret for gossip encryption, dispatch AEAD, and tx-token signing; no versioned-key rotation — changing it requires a full-cluster stop/start (see the `cluster` help topic, `SECRET ROTATION`).
- `CYODA_PROXY_TIMEOUT` (duration, default: `30s`) — the bound on the wait for a transaction's owner to begin answering a request forwarded to it (HTTP: its response headers; gRPC: a unary call's response, or a streamed call's first message), past which the request answers `503 TRANSACTION_NODE_UNAVAILABLE`, not retryable once the request was sent, because the owner may have run it; also the bound on one platform clock confirmation round (every peer contacted in parallel), and the bound on each status ask of `GET /platform/cluster`; half of it bounds the database check of the node that answers the ask (see the `cluster` help topic, `CLUSTER STATUS`). Must be `> 0`; startup fails otherwise.
- `CYODA_DISPATCH_WAIT_TIMEOUT` (duration, default: `5s`) — the patience: how long one callout waits, in total, for a compute member with matching tags to exist. It applies on a single node as in a cluster and whatever the callout's `retryPolicy` — waiting for a member to exist is not a retry and costs no try. The wait ends the moment a member attaches or a peer announces one. `0` disables waiting: a callout with no member fails at once with `NO_COMPUTE_MEMBER_FOR_TAG`. Must not be negative; startup fails otherwise.
- `CYODA_DISPATCH_CONNECT_TIMEOUT` (duration, default: `2s`) — time allowed to open the connection when a callout is handed over to another node. A node that cannot be connected to costs no try; the next one is asked. Behind a sidecar or an ingress the connection always opens and a dead peer shows as a 502–504, which counts as one try. Must be `> 0`; startup fails otherwise.
- `CYODA_CALLOUT_HANDOVER_ALLOWANCE` (duration, default: `30s`) — what the owning node allows a hand-over on top of `tries left × answer limit`, and the last term of a callout's overall deadline (`tries × answer limit + CYODA_DISPATCH_WAIT_TIMEOUT + this`; 155 s at the defaults). Must be `> 0`; startup fails otherwise.
- `CYODA_CALLOUT_PASS_ALLOWANCE` (duration, default: `30s`) — how long the transaction token given to a compute member outlives its try's answer limit: the margin for routing a callback between nodes and for clocks that differ between them. Must be `> 0`; startup fails otherwise.
- [`cyoda help run`](/help/run/) — cyoda-go is a single-process, multi-tenant REST and gRPC API server. It starts in serving mode when invoked with no subcommand or with `serve`. All configuration is via environment variables with a `CYODA_` prefix. The binary, Docker image, and Helm chart run the same binary; only the environment configuration differs across run modes.

## Raw formats

- [`/help/config/clock.json`](/help/config/clock.json) — full descriptor (matches `GET /help/{topic}` envelope)
- [`/help/config/clock.md`](/help/config/clock.md) — body only