How we can set ENV for Task in v9 like we used to do in v8

How can we set to run task with specific --env parameters, or v9 doesn’t have a capability?

In v8, we have multi server environment that we separate admin & editor users and public users. (e.g., we have two environment set as prod-admin and prod-app

Then, when we run the automated job, we run from admin CMS server with --env parameter. So that it won’t eat too much user’s end server resources.

V9 doesn’t have the capability yet?

Environment variables get pulled into the runtime when you run a command from the CLI. You can provide environment variables either by exporting them before running the CLI command or by specifying them inline with the command.

For us, when we have a webroot that powers more than one site and we want to target the proper site environment, we just specify it inline:

CONCRETE5_ENV=the_specific_env ./vendor/bin/concrete5 ...

Thx @Korvin

Ahh I understand…
Cool. I think I can make a good use of it at the most cases.

We have few clients which we need to set different variable.

Some cron job is set for admin environment, but other is set for production (user-end) environment.

At the most cases, we could just modify with the job code when updating to task.


1 Like