distillery v2.0.8 Mix.Releases.Config View Source

Responsible for parsing the release configuration file.

Link to this section Summary

Functions

Gets the current version of the given app and returns it as a string. If the app cannot be loaded, an error is raised. Intended to be used in conjunction with setting the version of a release definition, as shown below

Creates a new environment for building releases. Within an environment, you can set config options which apply to all releases built in that environment

Adds a plugin to the environment or release definition it is part of. Plugins will be called in the order they are defined. In the example below MyApp.ReleasePlugin will be called, then MyApp.MigratePlugin

Reads and validates a given configuration file. If the file does not exist, or an error occurs, a Mix.Releases.Config.LoadError will be raised

Reads and validates a string containing the contents of a config file. If an error occurs during reading, a Mix.Releases.Config.LoadError will be raised

Creates a new release definition with the given name. Within a release definition, you can set config options specific to that release

Set a config option within an environment or release definition. set takes a keyword list of one or more values to apply. An error will be raised if set is used outside of an environment or release definition, or if the config value being set does not exist

Validates a %Config{} struct. If the struct is not valid, an ArgumentError is raised. If valid, returns true

Link to this section Types

Link to this type t() View Source
t() :: %Mix.Releases.Config{
  default_environment: atom(),
  default_release: atom(),
  environments: Map.t(),
  is_upgrade: boolean(),
  releases: Map.t(),
  selected_environment: atom(),
  selected_release: atom(),
  upgrade_from: :latest | String.t()
}

Link to this section Functions

Link to this macro current_version(app) View Source (macro)

Gets the current version of the given app and returns it as a string. If the app cannot be loaded, an error is raised. Intended to be used in conjunction with setting the version of a release definition, as shown below.

Usage

release :myapp do
  set version: current_version(:myapp)
end
Link to this macro environment(name, list) View Source (macro)

Creates a new environment for building releases. Within an environment, you can set config options which apply to all releases built in that environment.

Usage

environment :dev do
  set dev_mode: true
  set include_erts: false
end
Link to this macro plugin(name, opts \\ []) View Source (macro)

Adds a plugin to the environment or release definition it is part of. Plugins will be called in the order they are defined. In the example below MyApp.ReleasePlugin will be called, then MyApp.MigratePlugin

Usage

release :myapp do
  plugin MyApp.ReleasePlugin
  plugin MyApp.MigratePlugin
end
Link to this function read!(file) View Source
read!(String.t()) :: Config.t() | no_return()

Reads and validates a given configuration file. If the file does not exist, or an error occurs, a Mix.Releases.Config.LoadError will be raised.

Link to this function read_string!(contents) View Source
read_string!(String.t()) :: Config.t() | no_return()

Reads and validates a string containing the contents of a config file. If an error occurs during reading, a Mix.Releases.Config.LoadError will be raised.

Link to this macro release(name, list) View Source (macro)

Creates a new release definition with the given name. Within a release definition, you can set config options specific to that release

Usage

release :myapp do
  set version: "0.1.0",
  set applications: [:other_app]
end

Set a config option within an environment or release definition. set takes a keyword list of one or more values to apply. An error will be raised if set is used outside of an environment or release definition, or if the config value being set does not exist.

Usage

environment :dev do
  set dev_mode: true
end
Link to this function validate!(config) View Source
validate!(Mix.Releases.Config.t()) :: true | no_return()

Validates a %Config{} struct. If the struct is not valid, an ArgumentError is raised. If valid, returns true.