View Source Igniter.Project.Config (igniter v0.3.4)

Codemods and utilities for modifying Elixir config files.

Summary

Functions

Sets a config value in the given configuration file, updating it with updater if it is already set.

Sets a config value in the given configuration file, if it is not already set.

Returns true if the given configuration path is set somewhere after the provided zipper, or in the given configuration file.

Modifies elixir configuration code starting at the configured zipper.

Functions

Link to this function

configure(igniter, file_name, app_name, config_path, value, opts \\ [])

View Source
@spec configure(
  Igniter.t(),
  Path.t(),
  atom(),
  [atom()],
  term(),
  opts :: Keyword.t()
) :: Igniter.t()

Sets a config value in the given configuration file, updating it with updater if it is already set.

Opts

  • :updater - A function that takes a zipper at a currently configured value and returns a new zipper with the value updated.
  • failure_message - A message to display to the user if the configuration change is unsuccessful.
Link to this function

configure_new(igniter, file_path, app_name, config_path, value, opts \\ [])

View Source
@spec configure_new(
  Igniter.t(),
  Path.t(),
  atom(),
  [atom()],
  term(),
  opts :: Keyword.t()
) :: Igniter.t()

Sets a config value in the given configuration file, if it is not already set.

Opts

  • failure_message - A message to display to the user if the configuration change is unsuccessful.
Link to this function

configures?(zipper, config_path, app_name)

View Source
@spec configures?(zipper :: Sourceror.Zipper.t(), [atom()], atom()) :: boolean()
Link to this function

configures?(igniter, file, path, app_name)

View Source
@spec configures?(Igniter.t(), file :: String.t(), [atom()], atom()) :: boolean()

Returns true if the given configuration path is set somewhere after the provided zipper, or in the given configuration file.

Link to this function

modify_configuration_code(zipper, config_path, app_name, value, updater \\ nil)

View Source
@spec modify_configuration_code(
  Sourceror.Zipper.t(),
  [atom()],
  atom(),
  term(),
  (Sourceror.Zipper.t() -> {:ok, Sourceror.Zipper.t()} | :error) | nil
) :: Sourceror.Zipper.t()

Modifies elixir configuration code starting at the configured zipper.

If you want to set configuration, use configure/6 or configure_new/5 instead. This is a lower-level tool for modifying configuration files when you need to adjust some specific part of them.