Igniter.Config (igniter v0.1.0)

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.

Modifies elixir configuration code starting at the configured zipper.

Functions

Link to this function

configure(igniter, file_name, app_name, config_path, value, updater \\ nil)

@spec configure(
  Igniter.t(),
  Path.t(),
  atom(),
  [atom()],
  term(),
  (Sourceror.Zipper.t() -> {:ok, Sourceror.Zipper.t()} | :error) | nil
) :: Igniter.t()

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

Link to this function

configure_new(igniter, file_path, app_name, config_path, value)

@spec configure_new(Igniter.t(), Path.t(), atom(), [atom()], term()) :: Igniter.t()

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

Link to this function

configures?(zipper, config_path, app_name)

@spec configures?(Sourceror.Zipper.t(), [atom()], atom()) :: boolean()

Returns true if the given configuration path is set somewhere after the provided zipper.

Link to this function

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

@spec modify_configuration_code(
  Sourceror.Zipper.t(),
  [atom()],
  atom(),
  term(),
  (Sourceror.Zipper.t() -> {:ok, Sourceror.Zipper.t()} | :error) | nil
) :: Igniter.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.