You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Pipe credentials to command (optional)](#pipe-credentials-to-command-optional)
12
13
-[Usage](#usage)
13
14
-[Creating credentials](#creating-credentials)
14
15
-[Editing credentials](#editing-credentials)
16
+
-[Piping credentials](#piping-credentials)
15
17
-[Using in production](#using-in-production)
16
18
-[How it works](#how-it-works)
17
19
@@ -62,7 +64,11 @@ new Ignitor(__dirname).httpServer().start().catch(console.error)
62
64
63
65
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.
64
66
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)
66
72
67
73
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.
68
74
@@ -80,9 +86,15 @@ new Ignitor(__dirname)
80
86
.catch(console.error)
81
87
```
82
88
83
-
#### Modify `.adonisrs.json`
89
+
This will populates credentials into the ace process so they will be available in it.
84
90
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.
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.
131
143
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)
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.
0 commit comments