Configuration

View Source

Introduction

Corex uses a small set of application environment keys. Most apps only need Phoenix Gettext configuration for translated component labels.

Before you start

RequirementNotes
Phoenix appconfig/config.exs loaded at runtime

Translations (Gettext)

Corex reads the same backend as Phoenix templates:

config :phoenix,
  gettext_backend: MyAppWeb.Gettext

Components with a translation assign (Select, Editable, Dialog, and others) use this backend for default labels when no struct is passed. See Localize.

config :corex

KeyTypeDefaultPurpose
:debugbooleanfalseWhen true, MCP request logging is verbose instead of silenced
:generatorskeyword[]Options for mix corex.gen.live and mix corex.gen.html (see below)

Generator keys:

KeyValuesPurpose
:gettexttrue, :sigils, or omitWhen true, generated copy uses gettext/1. When :sigils, uses ~t (needs gettext_sigils in html_helpers).
:gettext_sigilsbooleanAlias for gettext: :sigils
:layoutkeywordmode: true, theme: true, locale: true wire Layouts.app assigns in generated LiveViews / HTML

mix corex.new --lang writes gettext: :sigils and layout: [locale: true] (plus mode / theme when those flags are set). Generators also auto-detect GettextSigils in lib/my_app_web.ex when config is omitted.

Example:

config :corex,
  debug: false,
  generators: [
    gettext: :sigils,
    layout: [locale: true, mode: true, theme: true]
  ]

Phoenix uses a similar pattern on the web app, for example config :my_app, :generators, context_app: :my_app. Corex reads config :corex, :generators for layout and translation behavior in mix corex.gen.*.

MCP

MCP is configured on the endpoint, not under config :corex. See MCP. Enable only in :dev (or :test in generated apps); never in :prod.