|
| 1 | +## Cardano Providers Module |
| 2 | + |
| 3 | +### Introduction |
| 4 | + |
| 5 | +The Cardano Providers module defines a common interface for services that depend on a Cardano node. |
| 6 | +Instead of binding directly to a specific systemd unit, services interact with an abstract provider. |
| 7 | +This indirection makes it possible to switch seamlessly between different backends |
| 8 | +(for example, a local `cardano-node` or a remote tunnel such as Demeter) |
| 9 | +without changing service configuration. |
| 10 | + |
| 11 | +The module ensures that shared options and access rules are consistent across all consumers, while hiding implementation details of the underlying node. |
| 12 | + |
| 13 | +### Design Rationale |
| 14 | + |
| 15 | +This design has several advantages: |
| 16 | + |
| 17 | +- **Flexibility** – a consumer does not need to know whether the node is provided locally or remotely. |
| 18 | +- **Transparency** – switching between a local `cardano-node` and a remote tunnel (e.g., from Demeter) requires no changes on the consumer side. |
| 19 | +- **Reusability** – common configuration options are centralized and can be shared across different providers. |
| 20 | +- **Consistency** – consumers operate against a unified contract, regardless of the actual implementation. |
| 21 | + |
| 22 | +### Contract and Visibility |
| 23 | + |
| 24 | +Options under `cardano.provider.*` should be set only in respective provider implementations, |
| 25 | +and only referenced in other services. |
| 26 | + |
| 27 | +If a service provider is enabled, it must set `cardano.provider.$servicename.active = true`. |
| 28 | +Consumers can check `cardano.provider.$servicename.active` for service presence and use provider values without additional checks. |
| 29 | + |
| 30 | +### Service Integration Guidelines |
| 31 | + |
| 32 | +All new services added under `cardano.nix` must integrate exclusively through the provider interface: |
| 33 | + |
| 34 | +- Services must use `cardano.providers.node.socketPath` to locate the node socket. |
| 35 | + |
| 36 | +- Services must respect `cardano.providers.node.accessGroup` for Unix group-based permissions. |
| 37 | + |
| 38 | +- Direct references to a particular `cardano-node` systemd unit or its implementation details are forbidden. |
| 39 | + |
| 40 | +This rule applies not only to Cardano consumers like `cardano-cli` or monitoring tools, but also to middleware services such as Ogmios, Kupo, and others. |
| 41 | +The goal is to guarantee that any consumer can transparently switch between different backends (local node, remote tunnel, etc.) without reconfiguration. |
0 commit comments