Run modes
Purpose: Understand how one codebase behaves differently per instance and environment via run modes.
Who this page is for
| Audience | Why it matters to you |
|---|---|
| All engineers | Config-per-environment mechanics |
What they are
Startup flags that classify an instance. Standard: author or publish, plus environment modes your team defines (dev, stage, prod). Set via jar filename (aem-author-p4502.jar) or sling.run.modes property; fixed at startup.
What they select
| Mechanism | Example |
|---|---|
| OSGi config folders | /apps/phi-academy/osgiconfig/config.publish.prod/ applies only on prod publish |
| Code branches (rare, discouraged) | slingSettings.getRunModes().contains("author") |
| Installation of content | Packages can target run modes via install folders (install.author) |
config/ ← all instances
config.author/ ← any author
config.publish/ ← any publish
config.publish.prod/ ← prod publish only (most specific wins)
Rules of thumb
- Prefer config-by-runmode over code-by-runmode; code should be environment-agnostic.
- Never invent per-feature run modes; they are for environment/tier identity only.
- Secrets do not belong in run-mode configs in the repo — see Secrets management.
- When behaviour differs between author and publish unexpectedly, diff the effective configs first (configMgr on both).