HomeGuidesAPI ReferenceGraphQL
Submit Documentation FeedbackJoin Developer CommunityOptimizely GitHubOptimizely NuGetLog In

.env

This topic describes the .env file as it pertains to your application in Optimizely Connect Platform (OCP).

Sensitive secrets and tokens should never be checked into your code repository or submitted as part of your app package. In order to protect your secrets, you can use an optional .env file that should not be committed into your code repository (add to .gitignore, for example). If your app does not require global sensitive data, you do not have to include this file.

Add your secrets to the .env file in the root of your app in the following format:

APP_ENV_GLOBAL_SECRET=12345a83hd8blk34jsao2983hlaksd8
APP_ENV_CLIENT_ID=JEdi2hf8vH

🚧

Important

All app environment variables MUST start with APPENV.

Then add the same environment variable names to your app.yml under environment:

environment:
  - APP_ENV_GLOBAL_SECRET
  - APP_ENV_CLIENT_ID

This indicates these environment variables are required for your app to run so when you upload your app, the OCP CLI will ensure you included the values in your .env file before uploading the app.

When an app is uploaded, the OCP CLI will read the environment variable values and upload them separately and securely to the Optimizely Connect Platform (OCP). These values will be tied to the current app version you are uploading. After publishing your app, if you wish to update the values, you will need to upload a new version of your app with an updated .env file.

You can access these variables using process.env.APP_ENV_<name>.