Project environments
Introduction
Project environments allow having several variants of a project including different settings.
A common usage is to define one environment for production (eg. named prod),
one environment for development (eg. named dev), etc…
Then you can for example define different secret values in production and
development environments. You can also independently manage who can access to prod environment
and to dev environment.
Creation
When you create a project, an initial environment is automatically associated
to this project and is named: default.
Feel free to change this name and adjust settings depending on your needs.
Web UI
Environment management is available in the Environments tab of the project.

Use + ENVIRONMENT button to create a new environment knowing that settings are:
-
Name: mandatory field, better to keep short naming, -
Description: optional, free form string just used to help clarifying environment usage, -
Unprotected: when set, allows exporting or retrieving project settings (including secrets definition) outside of the factory
WARNING: It is not recommended to unprotect an environment dedicated to production.
Unprotecting an environment may result in leaking internal settings and / or secrets definition outside of the factory.
Nevertheless, note that a project environment must be unprotected to allow “cloning” the project locally in a local builder (see local builder project packaging chapter for more details.)
rp-cli
It is also possible to manage project environments from redpesk command line, alias rp-cli.
To create a new environment:
$ rpcli projects environments add my-nice-project dev2 --description "Dedicated to the 2nd development team"
-- Environment creation requested by user --
Request the factory to create the new environment 'dev2'... [OK]
To list the environments of a project, just use the slug of your project :
$ rpcli projects environments list my-nice-project
Name Default Unprotected
prod true false
dev false true
dev2 false true
$ rpcli projects environments list my-nice-project --verbose
Name: prod
Description: Environment dedicated to production
Project UUID: 0c172dc6-22fa-46d2-807b-a31e349a1f9c
Default: true
Unprotected: false
Name: dev
Description: Environment dedicated to development
Project UUID: ee2a9b92-0518-4adc-ac98-7f59f91aa509
Default: false
Unprotected: true
Name: dev2
Description: Environment dedicated to the 2nd development team
Project UUID: 85670fed-2499-4d1b-b390-90ea742c763d
Default: false
Unprotected: false
Selection
Web UI
You can easily switch environment or check which environment is currently selected by using the drop-down box located in the top-right part of the Web UI.
Here below an example with two environments (prod is currently selected):

rp-cli
All the commands where an environment needs to be specified include an env-name argument.
Update
Web UI
To update an environment, browse to Environments tab of the project and simply
click on the pencil icon of the environment you want to update.
Update the field you want to change and then click on Save.
rp-cli
To update an environment, just specify the project slug, the environment name and the option you want to change:
rpcli projects environments update my-nice-project dev2 --unprotected true
-- Environment update requested by user --
The environment 'dev2 of project my-nice-project is currently protected.
Attention! When a project's environment is unprotected, some data may be exposed externally, for example in local builder.
Are you sure you want to unprotect the environment 'dev2' of project 'my-nice-project'? (Y/n)
> y
Request the factory to update the environment 'dev2'... [OK]
Note: you can use
--forceoption to avoid interactive confirmation.
WARNING: It is not recommended to unprotect an environment dedicated to production usage. Unprotecting an environment may result in leaking internal settings and / or secrets definition outside of the factory.
Deletion
Web UI
To delete an environment, browse to Environments tab of the project and simply
click on the trash icon of the environment you want to delete.
rp-cli
To delete an environment, just specify the project slug and the environment name as follows:
$ rpcli projects environments delete my-nice-project dev2
-- Environment deletion requested by user --
Are you sure you want to delete the environment 'dev2'? (Y/n)
> y
Request the factory to delete the environment 'dev2'... [OK]
Note: you can use
--forceoption to avoid interactive confirmation.