Skip to content

Commit 6c13d9d

Browse files
authored
Merge pull request #505 from filmaj/credential-usage-docs
expanding on credential usage docs
2 parents 3d46fc7 + 6dd9655 commit 6c13d9d

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

docs/credentials.md

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Credentials
22

3-
When you test functionality that involves external services such as UPS, FedEx, PayPal, or SignifyD,
3+
When you test functionality that involves external services such as UPS, FedEx, PayPal, or SignifyD,
44
use the MFTF credentials feature to hide sensitive [data][] like integration tokens and API keys.
55

66
Currently the MFTF supports two types of credential storage:
@@ -53,9 +53,9 @@ magento/carriers_usps_password=Lmgxvrq89uPwECeV
5353
#magento/carriers_dhl_id_us=dhl_test_user
5454
#magento/carriers_dhl_password_us=Mlgxv3dsagVeG
5555
....
56-
```
56+
```
5757

58-
Or add new key & value pairs for your own credentials. The keys use the following format:
58+
Or add new key/value pairs for your own credentials. The keys use the following format:
5959

6060
```conf
6161
<vendor>/<key_name>=<key_value>
@@ -64,7 +64,7 @@ Or add new key & value pairs for your own credentials. The keys use the followin
6464
<div class="bs-callout bs-callout-info" markdown="1">
6565
The `/` symbol is not supported in a `key_name` other than the one after your vendor or extension name.
6666
</div>
67-
67+
6868
Otherwise you are free to use any other `key_name` you like, as they are merely the keys to reference from your tests.
6969

7070
```conf
@@ -74,10 +74,10 @@ vendor/my_awesome_service_token=rRVSVnh3cbDsVG39oTMz4A
7474

7575
## Configure Vault Storage
7676

77-
Hashicorp vault secures, stores, and tightly controls access to data in modern computing.
78-
It provides advanced data protection for your testing credentials.
77+
Hashicorp vault secures, stores, and tightly controls access to data in modern computing.
78+
It provides advanced data protection for your testing credentials.
7979

80-
The MFTF works with both `vault enterprise` and `vault open source` that use `KV Version 2` secret engine.
80+
The MFTF works with both `vault enterprise` and `vault open source` that use `KV Version 2` secret engine.
8181

8282
### Install vault CLI
8383

@@ -95,8 +95,8 @@ vault login -method -path
9595

9696
### Store secrets in vault
9797

98-
The MFTF uses the `KV Version 2` secret engine for secret storage.
99-
More information for working with `KV Version 2` can be found in [Vault KV2][Vault KV2].
98+
The MFTF uses the `KV Version 2` secret engine for secret storage.
99+
More information for working with `KV Version 2` can be found in [Vault KV2][Vault KV2].
100100

101101
#### Secrets path and key convention
102102

@@ -125,9 +125,9 @@ vault kv put secret/mftf/magento/carriers_usps_password carriers_usps_password=L
125125

126126
### Setup MFTF to use vault
127127

128-
Add vault configuration environment variables [`CREDENTIAL_VAULT_ADDRESS`][] and [`CREDENTIAL_VAULT_SECRET_BASE_PATH`][]
128+
Add vault configuration environment variables [`CREDENTIAL_VAULT_ADDRESS`][] and [`CREDENTIAL_VAULT_SECRET_BASE_PATH`][]
129129
from `etc/config/.env.example` in `.env`.
130-
Set values according to your vault server configuration.
130+
Set values according to your vault server configuration.
131131

132132
```conf
133133
# Default vault dev server
@@ -137,7 +137,7 @@ CREDENTIAL_VAULT_SECRET_BASE_PATH=secret
137137

138138
## Configure both File Storage and Vault Storage
139139

140-
It is possible and sometimes useful to setup and use both `.credentials` file and vault for secret storage at the same time.
140+
It is possible and sometimes useful to setup and use both `.credentials` file and vault for secret storage at the same time.
141141
In this case, the MFTF tests are able to read secret data at runtime from both storage options, but the local `.credentials` file will take precedence.
142142

143143
<!-- {% raw %} -->
@@ -150,11 +150,12 @@ Define the value as a reference to the corresponding key in the credentials file
150150

151151
- `_CREDS` is an environment constant pointing to the `.credentials` file
152152
- `my_data_key` is a key in the the `.credentials` file or vault that contains the value to be used in a test step
153+
- for File Storage, ensure your key contains the vendor prefix, i.e. `vendor/my_data_key`
153154

154-
For example, reference secret data in the [`fillField`][] action with the `userInput` attribute.
155+
For example, to reference secret data in the [`fillField`][] action, use the `userInput` attribute using a typical File Storage:
155156

156157
```xml
157-
<fillField stepKey="FillApiToken" selector=".api-token" userInput="{{_CREDS.my_data_key}}" />
158+
<fillField stepKey="FillApiToken" selector=".api-token" userInput="{{_CREDS.vendor/my_data_key}}" />
158159
```
159160

160161
<!-- {% endraw %} -->

0 commit comments

Comments
 (0)