Skip to content

Commit f203068

Browse files
committed
chore: update readme and bump version
1 parent 19f63ab commit f203068

File tree

2 files changed

+34
-5
lines changed

2 files changed

+34
-5
lines changed

README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
- [Configuration](#configuration)
88
- [Run `ace configure`](#run-ace-configure)
99
- [Modify `server.ts` file](#modify-serverts-file)
10-
- [Modify `ace` file](#modify-ace-file)
1110
- [Modify `.adonisrs.json`](#modify-adonisrsjson)
11+
- [Modify `ace` file (optional)](#modify-ace-file-optional)
12+
- [Pipe credentials to command (optional)](#pipe-credentials-to-command-optional)
1213
- [Usage](#usage)
1314
- [Creating credentials](#creating-credentials)
1415
- [Editing credentials](#editing-credentials)
16+
- [Piping credentials](#piping-credentials)
1517
- [Using in production](#using-in-production)
1618
- [How it works](#how-it-works)
1719

@@ -62,7 +64,11 @@ new Ignitor(__dirname).httpServer().start().catch(console.error)
6264

6365
This allows the credentials to be parsed and populated inside current `process.env` before the app even starts, so an `Env` provider will be able to validate values.
6466

65-
#### Modify `ace` file
67+
#### Modify `.adonisrs.json`
68+
69+
As a final step, open `.adonisrc.json` file and add `resources/credentials` to `metaFiles` section, so credentials will copied as you build your Adonis app.
70+
71+
#### Modify `ace` file (optional)
6672

6773
In this step you do basically the same thing as done in a step above, but for `ace` commands that need the app to be loaded, just add two new lines to the file.
6874

@@ -80,9 +86,15 @@ new Ignitor(__dirname)
8086
.catch(console.error)
8187
```
8288

83-
#### Modify `.adonisrs.json`
89+
This will populates credentials into the ace process so they will be available in it.
8490

85-
As a final step, open `.adonisrc.json` file and add `resources/credentials` to `metaFiles` section, so credentials will copied as you build your Adonis app.
91+
#### Pipe credentials to command (optional)
92+
93+
Another way to make credentials visible to command, is to run that command inside a child process with secret credentials populated, for example:
94+
95+
`node ace credentials:pipe 'ace migrations:run'`
96+
97+
This reads credentials, decrypts them, creates a child process and populates environment with some new values from your vault and then runs the command that you specified.
8698

8799
## Usage
88100

@@ -129,6 +141,23 @@ node ace credentials:edit --editor=nano --env=development
129141

130142
This will decrypt the credentials file, create a temporary one and open it in the editor you specified. As you finish editing, close the file (or tab inside your editor), this will encrypt it back again and remove the temporary file, to keep you safe and sound.
131143

144+
#### Piping credentials
145+
146+
To pipe credentials to a command that needs them run:
147+
148+
```bash
149+
# node ace credentials:pipe <command>
150+
# ---
151+
# Args
152+
# command Specify an ace command to pipe credentials to
153+
# Flags
154+
# --env string Specify an environment for credentials file (default: development)
155+
156+
node ace credentials:pipe 'ace migrations:run'
157+
# or
158+
node ace credentials:pipe 'ace migrations:run' --env=development
159+
```
160+
132161
#### Using in production
133162

134163
You can have multiple credential files, the best way to work is to create one for each environment, for example: development, production, staging, test and etc.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@bitkidd/adonis-credentials",
3-
"version": "1.0.4",
3+
"version": "1.1.0",
44
"description": "A credentials provider for Adonis 5.x",
55
"types": "build/adonis-typings/index.d.ts",
66
"main": "build/providers/CredentialsProvider.js",

0 commit comments

Comments
 (0)