Set up environmental variables - dotherightthing/generator-wpdtrt-plugin-boilerplate GitHub Wiki
Summary
Status
- Up to date @ 0.9.0
TODO clarify where these should be generated
Generate tokens
Cypress.io test recording
- Name:
CYPRESS_RECORD_KEY
- Open the Cypress Test Runner:
./node_modules/.bin/cypress open
- Click on the Runs tab of your project
- Click Set up Project to Record
- Copy the string following
--key
- Recordings are available locally and on https://dashboard.cypress.io/
See: Cypress.io - Set up a project to record
Github API token
An API token provides access to a higher rate limit for API requests, of 5000 requests per hour (usually 60 per hour). This prevents failures when running Composer installs with a lot of nested dependencies.
The API token also provides the necessary permissions for the CI to clone private repositories (using Composer) and to deploy the release zip.
- Name:
GH_TOKEN
- View your Personal Access Tokens
- Generate new token e.g.
GH_TOKEN for username/wpdtrt-yourpluginname
, or reuse an existing token e.g.GH_PAT_WPDTRT_DBTH
- Select scopes:
repo
>public_repo
(note:repo
may be required, see https://github.com/dotherightthing/wpdtrt-npm-scripts/issues/54) - Generate token
- Copy the generated token's value to your plugin repo's
GH_TOKEN
MySQL credentials
These three MySQL credentials are required to create and manage databases.
- Name:
WPUNIT_DB_HOST
(DB_HOST
inwp-config.php
) - Name:
WPUNIT_DB_PASS
(DB_PASSWORD
inwp-config.php
) - Name:
WPUNIT_DB_USER
(DB_USER
inwp-config.php
)
Consult your local LAMP stack (or wp-config
) for these values.
Tip: I have my WPUNIT_DB_HOST
set to 127.0.0.1
rather than localhost
. I'm not sure if this makes a difference or not.
See also DTRT WordPress Plugin Boilerplate: Testing & Debugging.
Tenon API key
An API token provides access to the Tenon.io accessibility testing engine.
- Name:
TENON_API_KEY
- Register, if you don't already have an account
- View your API Key
- Copy the token
Store the tokens on your local system
This allows you to run builds and use the Yeoman generator on your local system.
- Open Terminal
- Open your bash profile:
nano ~/.bash_profile
- Add these lines to store the tokens there (
export
ing a variable causes it to be inherited by subsequently started processes in the shell session):
export CYPRESS_RECORD_KEY="your_value"
export GH_TOKEN="your_value"
export TENON_API_KEY="your_value"
export WPUNIT_DB_HOST="your_value"
export WPUNIT_DB_PASS="your_value"
export WPUNIT_DB_USER="your_value"
- Save the changes and exit nano:
CONTROL+X, Y(es), ENTER
- Close and reopen the Terminal
Store the tokens in Github
This allows you to run CI builds.