From 8785635e7cc333fb5c6e5c4f2eb6f5d977568d68 Mon Sep 17 00:00:00 2001 From: Marc MacLeod Date: Wed, 7 Feb 2018 17:12:33 -0600 Subject: [PATCH] Update environments.md add dos and donts, re-work intro a bit, indicate private are merged over default variables --- articles/editor/environments.md | 41 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 21 deletions(-) diff --git a/articles/editor/environments.md b/articles/editor/environments.md index 4930b25..5be8849 100644 --- a/articles/editor/environments.md +++ b/articles/editor/environments.md @@ -2,44 +2,43 @@ -The Stoplight editor includes an embedded configuration system that can be used -to auto-populate environment information and other variables (hostnames, ports, -passwords, etc.) utilized by specifications, scenarios, or collections. To -display the current editor environment variables, click the icon on the top -right of the Stoplight editor as shown in the image above. +An environment is simply a container for data, represented as a list of key-value pairs (behind the scenes, this is a JSON object). Every Stoplight project has one or more environments associated with it. The data stored in an environment can be used in many places within the Stoplight editor. + +Environments, and their default data, are defined in the [Stoplight configuration file](./editor-configuration.md#environments). + +- __Do__ create an environment for each development environment associated with the project. For example, `development`, `staging`, and `production`. +- __Don't__ create environments for individual users. Instead, use private variables (below) to customize existing environments. +- __Do__ use environment default data to store shared information like hostnames, ports, passwords, etc. +- __Don't__ use environments to store fixture/seed/temporary data. -For more information on environment variables and how they can be used, please +For more information on environment variables and how they can be used during API testing, please see [here](../testing/variables-environment.md). ## Private Variables -Private Variables are variables that are _only_ stored locally on your system +Private Variables are _only_ stored locally on your system, and are never sent to Stoplight or the rest of your team. Private variables should be reserved for secrets specific to you, such as user-specific passwords, -API keys, and other pieces of sensitive data. +API keys, and other pieces of sensitive and/or individually specific data. + +Edit private variables by clicking on the environment button in the top right of the Stoplight editor. > Since private variables are only stored on your computer, make sure they are - backed up in a secure location + backed up in a secure location. ## Resolved Variables Resolved Variables shows a read-only view of the variables that are currently exposed to your editor. They are based on: -* Your current environment -* Your private variables +* The currently selected (active) environment +* The active environment's default variables, as defined in the stoplight configuration file +* The active environment's private variables, as defined by you -These variables (excluding your private variables) are stored in the -`.stoplight` file of your project (under "Config" in the File Explorer). - -The Resolved Variables displayed in the editor will change depending on your -current environment. To update the default or environment-specific variables -stored in Stoplight, click the "Manage Environments" button under the -configuration window. - - +Private variables are merged over default variables that share the same name. This makes it easy +for individual team members to customize and extend environments without affecting the rest of the team. For more information on updating and customizing environment variables, please see [here](./editor-configuration.md#environments). @@ -48,5 +47,5 @@ see [here](./editor-configuration.md#environments). **Results** -* [Using Environment Variables](../testing/variables-environment.md) +* [Using Environment Variables in Testing](../testing/variables-environment.md) * [Configuration with the `.stoplight.yml` File](./editor-configuration.md#environments)