Gradle detect -dev mode

Enonic version: 7.12.2
OS: Linnux

Dear Enonic Team,
Can you please tell me how to detect inside react4xp.gradle if enonic is runnig with dev mode?

For instance, there is startParameter.isContinuous() that allows us to detect if enonic is runnig with “-c” flag

I need to set NODE_ENV equal to “development” or “production” depend on -dev flag

Compile mode and runtime mode are two different things.
The NODE_ENV in your example is about compile environment, not runtime environment.

I don’t know if there is a way to detect if XP is running in DEV mode, perhaps via some REST API.

If you install the Server Status admin tool, it’s visible here:
http://localhost:8080/admin/tool/com.enonic.app.status/system-info

You can run a dev build in prod mode, and a prod build in dev mode.

This might help:

1 Like
$ enonic system i
? Authentication token (<user>:<password>):  *****************************
Loading...{
    "Version": "7.13.0-SNAPSHOT",
    "Installation": "demo",
    "RunMode": "PROD",
    "Build": {
        "Hash": "ce361f6e44f1a191682138363c5ab9546fc62a18",
        "ShortHash": "ce361f6",
        "Branch": "master",
        "Timestamp": "2023-03-13T06:02:37Z"
    }
}

(enonic system i -a user:password|grep RunMode|grep DEV) 2>/dev/null;echo $?

Thanks for your answer and advices Christian.
I’ll look into it.

1 Like