>_ IzzyLab

Topic breakdown

Environment variables set the context for processes, and to make them appear for all users system-wide, they are declared not in a personal ~/.bashrc but at the level of the whole system. When a login session starts, bash reads /etc/profile, which automatically sources every *.sh script from the /etc/profile.d/ directory. The export keyword is mandatory: without it the variable won't reach the environment of child processes. The - flag of su gives exactly a login session, which makes it convenient for verifying the result.

What's checked

  1. APP_ENV=production in root's login shell
  2. APP_ENV=production for a regular user

What it looks like