CredoHotUpgrades.Check.CompileTimeEnv (CredoHotUpgrades v1.0.0)

Copy Markdown View Source

Basics

This check is disabled by default.

Learn how to enable it via .credo.exs.

This check has a base priority of normal and works with any version of Elixir.

Explanation

A module attribute is evaluated once, when the module is compiled. @url Application.get_env(:myapp, :url) or @url System.get_env("APP_URL") bakes in whatever that machine's environment held at build time, not the environment of the node that eventually runs the release.

A hot upgrade loads the compiled module as-is: it never re-evaluates the attribute, so the value stays wrong until a full deploy rebuilds the module. Read the configuration at runtime instead, or use Application.compile_env/3, which at least fails the boot of a release where the compiled and the running value disagree rather than silently keeping the stale one.

Check-Specific Parameters

There are no specific parameters for this check.

General Parameters

Like with all checks, general params can be applied.

Parameters can be configured via the .credo.exs config file.