How do I programmatically know which run-mode the instance is running? I created a custom tag that provides the config depending on the instance run-mode, but I can not dete
As Bertrand Delacretaz said it is the right way to check whether instance is Author or Publish. In jsp or java you could check like
import org.apache.sling.settings.SlingSettingsService
Set runModes = sling.getService(SlingSettingsService.class).getRunModes();
if (runModes.contains("author")) {
}
Another way is using
if (mode == WCMMode.EDIT)
{
}
But this approach will fail in case of Preview mode and wouldn't work.