PhoenixKit.Install.PrefixConfig (phoenix_kit v1.7.208)

Copy Markdown View Source

Persists the --prefix install option into the host's config files.

mix phoenix_kit.install --prefix "auth" bakes the prefix into the generated migration, but the migration docs also tell hosts to set

config :phoenix_kit, prefix: "auth"

Without that config entry, later tooling (mix phoenix_kit.update, mix phoenix_kit.status) defaults to "public", reports the install as missing, and — worst case — generates a from-scratch migration into the wrong schema. This module writes the config entry whenever a non-public prefix is used, mirroring how the repo config is added.

Summary

Functions

Adds config :phoenix_kit, prefix: prefix to config.exs and test.exs when installing with a non-public prefix. No-op for the default "public" prefix (or when no prefix option was given).

Resolves the effective schema prefix for phoenix_kit mix tasks.

Functions

add_prefix_configuration(igniter, prefix)

@spec add_prefix_configuration(term(), String.t() | nil) :: term()

Adds config :phoenix_kit, prefix: prefix to config.exs and test.exs when installing with a non-public prefix. No-op for the default "public" prefix (or when no prefix option was given).

resolve_prefix(opts)

@spec resolve_prefix(keyword() | map()) :: String.t()

Resolves the effective schema prefix for phoenix_kit mix tasks.

Order: explicit --prefix option → config :phoenix_kit, :prefix"public". Raises ArgumentError for a prefix the migration chain would reject anyway (empty string, uppercase, dashes, injection shapes) — failing at the task boundary beats failing mid-migration.