# `CredoHotUpgrades.Check.CompileTimeEnv`
[🔗](https://github.com/deployex/credo_hot_upgrades/blob/main/lib/credo_hot_upgrades/check/compile_time_env.ex#L1)

## Basics

> #### This check is disabled by default. {: .neutral}
>
> [Learn how to enable it](`e:credo:config_file.html#checks`) 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](`e:credo:check_params.html`) can be applied.

Parameters can be configured via the [`.credo.exs` config file](`e:credo:config_file.html`).

---

*Consult [api-reference.md](api-reference.md) for complete listing*
