pallet.environment documentation

The environment provide a mechanism for customising pallet and pallet crates according to some externally determined criteria.

An environment can be specified at the global, service, invocation and tag scopes.

To provide a global default, specify an :environment key at the top level of defpallet in ~/.pallet/config.clj.

To provide a service spevific default, specify an :environment key at the service level of defpallet in ~/.pallet/config.clj.

To provide a project specific default, define pallet.config/environment.

To provide a specific environment when invoking lift or converge, pass an environment map using the :environment key.

The merging of values between scopes is key specific, and is determined by merge-key-algorithm.

Environment

A protocol for accessing an environment.

eval-environment

[env-map]

Evaluate an environment literal. This is used to replace certain keys with objects constructed from the map of values provided. The keys that are evaluated are: - :user - :phases - :algorithms

get-for

[session keys]
[session keys default]

Retrieve the environment value at the path specified by keys. When no default value is specified, then raise a :environment-not-found if no environment value is set.

(get-for {:p {:a {:b 1} {:d 2}}} [:p :a :d])
  => 2

merge-environments

[& maps]

Returns a map that consists of the rest of the maps conj-ed onto the first. If a key occurs in more than one map, the mapping(s) from the latter (left-to-right) will be combined with the mapping in the result by calling (merge-key key val-in-result val-in-latter).

merge-key-algorithm

Map from key to merge algorithm. Specifies how environments are merged.

node-keys

node specific environment keys

session-with-environment

[session environment]

Returns an updated session map, containing the keys for the specified environment map.

When session includes a :server value, then the :server value is treated as an environment, and merge with any environment in the environment's :groups key.

The node-specific environment keys are :images and :phases.

shell-expand-keys

[user-map keys]

Shell expand the values matching the specified keys

environment

[_]

Returns an environment map