
Security News
Open Source Maintainers Demand Ability to Block Copilot-Generated Issues and PRs
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
@commercetools-frontend/cypress-environments
Advanced tools
Cypress package to setup environment configuration using dotenv files
This package allows to load environment variables into a Cypress environment from dotenv files.
$ npm install --save @commercetools-frontend/cypress-environments
Inside of your cypress.config.js
import the package as follows:
const {
getConfigurationForEnvironment,
} = require('@commercetools-frontend/cypress-environments');
Then inside your e2e.setupNodeEvents
in Cypress v10.x load the configuration by calling await getConfigurationForEnvironment(environment)
.
This will return an object with the merged configuration based on the requested environment.
This module uses cosmiconfig to load a configuration file named cypress-environments
. As a result it supports many formats such as cypress-environments.config.cjs
or cypress-environments.rc.json
depending on your preference.
Within the configuration file an array environments
property should be defined containing a set of environments with name
, secrets
and config
globs.
The contents of the configuration file could look like:
const projectKeys = {
gcpEu: 'ctp-gcp-production-eu',
};
module.exports = {
environments: [
{
name: projectKeys.gcpEu,
secrets: `cypress/config/${projectKeys.gcpEu}/.env.secrets*`,
config: `cypress/config/${projectKeys.gcpEu}/.env.config*`,
},
],
};
From here the documentation assumes the above format and naming for further examples.
The package expects configurations for environments to be stored in cypress/config/<environment_name>
. For example this structure:
cypress/config
βββ ctp-gcp-production-eu
|ββββ .env.config
|ββββ .env.secrets.ci (Decrypred from `*.enc`)
|ββββ .env.config.local.template
|ββββ .env.secrets.local.template
βββ ctp-aws-production-fra
βββ ctp-vw-production-eu
Would load the values from .env.config
anytime the environment is ctp-gcp-production-eu
. Additionally on CI (when CI=true
) it would load the .env.secrets.ci
file, otherwise it would attempt to load values from .env.config.local
and .env.secrets.local
(assuming they have been properly configured - see *.template
files for reference).
Given multiple files can be loaded some values can be overwritten by a subsequently loaded file. First the .env.config
file will be loaded. After the secrets from .env.secrets
and then .env.secrets.ci
or .env.secrets.local
respectively. Any file loaded later can overwrite values of a file loaded before.
The module provides default values for ctp-aws-production-fra
, ctp-gcp-production-eu
, ctp-gcp-production-us
and ctp-gcp-production-au
. These values will be loaded first before any custom configuration. These default configurations contain the API_URL
, MC_API_URL
, MC_URL
and AUTH_URL
for the given environment.
Inspect the logs of the module to inspect which files match the globs. This output could be:
βΉοΈ 'CI' environment variables are defined. Assuming operating from a CI system.
βΉοΈ Found 1 secret file(s) and 1 config file(s) matching the defined globs.
β
Found and loading environment variables from: 'cypress/config/ctp-gcp-production-eu/.env.config'
βΉοΈ No environment variables at: 'cypress/config/ctp-gcp-production-eu/.env.config.ci'. If needed create it or duplicate the template file.
β
Found and loading environment variables from: 'cypress/config/ctp-gcp-production-eu/.env.secrets.ci'
β
Found and loading environment variables from: '/Users/<username>/merchant-center-frontend/packages-cypress/environments/src/config/.env.ctp-gcp-production-eu.config'
Verify that the files are loaded as expected and make sure they exist.
Make sure the secrets are decrypted on CI from the *.enc
or locally a *.template
file for the secrets has been duplicated and filled.
Ensure that the CI
environment variable is set. Most CI providers set it by default but you can also pass it to the command when running Cypress.
FAQs
Cypress package to setup environment configuration using dotenv files
The npm package @commercetools-frontend/cypress-environments receives a total of 236 weekly downloads. As such, @commercetools-frontend/cypress-environments popularity was classified as not popular.
We found that @commercetools-frontend/cypress-environments demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.Β It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Open source maintainers are urging GitHub to let them block Copilot from submitting AI-generated issues and pull requests to their repositories.
Research
Security News
Malicious Koishi plugin silently exfiltrates messages with hex strings to a hardcoded QQ account, exposing secrets in chatbots across platforms.
Research
Security News
Malicious PyPI checkers validate stolen emails against TikTok and Instagram APIs, enabling targeted account attacks and dark web credential sales.