Module context

Module context 

Source
Expand description

Context describes the normalized and processed “settings” that a command can use at runtime. This differs from the “config” or the “CLI Arguments” as the Context is built and updated from those sources. This means the context is responsible for de-conflicting mutually exclusive options, or overriding values.

The Context is source of truth for all runtime decisions.

The order of evaluation is as follows (note lower layers override layers above):

  1. System configuration files are loaded (if any…currently none are defined)
  2. User configuration files are loaded (if any are found)
  3. Environment Variables (currently none are defined)
  4. Command Line Arguments 4a. Because we use subcommands and global arguments each subcommand acts as it’s own set of Command Line Arguments, and can thus affect the Context at each level in the command hierarchy. 4b. Before the Context is handed off mutably to the next nested level, all updates from the parent should be finalized.

After these steps the final Context is what is used to make runtime decisions.

The context struct itself contains “global” values or those that apply in many scenarios or to many commands. It also contains specialized contexts that contain values only relevant to those commands or processes that need them. These specialized contexts should be lazily derived.

Re-exports§

pub use flight::FlightCtx;
pub use formation::FormationCfgCtx;
pub use formation::FormationCtx;
pub use metadata::MetadataCtx;
pub use locks::LocksCtx;
pub use restrict::RestrictCtx;

Modules§

flight
formation
locks
metadata
restrict

Structs§

Args
Ctx
The source of truth “Context” that is passed to all runtime processes to make decisions based on user configuration
Db
The in memory “Databases”
LateInit

Constants§

DEFAULT_IMAGE_REGISTRY_URL
The registry to use for image references when the registry is omitted by the user