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
To configure credentials provider, we should proceed with 4 steps:
39
+
40
+
#### Run `ace configure`
41
+
33
42
```
34
43
node ace configure @bitkidd/adonis-credentials
35
44
```
36
45
37
46
This will add two new commands to your app and will allow to create and edit credentials.
47
+
At the same time it will add a new rule to your `.gitignore` file that will exclude all `*.key` files from repository and will not allow to commit them.
48
+
49
+
#### Modify `server.ts` file
38
50
39
-
As a next step you need to modify the `server.ts` file. Add a new line inside it, just before the `Ignitor`:
51
+
As a next step you need to modify the `server.ts` file and add a new line inside it, just before the `Ignitor`:
40
52
41
53
```ts
54
+
// This goes on top, where import declarations are
It has to be done to populate values before Adonis starts and Env provider validates values.
63
+
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
+
65
+
#### Modify `ace` file
66
+
67
+
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
+
69
+
```js
70
+
// ...
71
+
// This goes on top, where require declarations are
newCredentials().initialize() // <--- Insert credentials initialization here, before the Ignitor
77
+
newIgnitor(__dirname)
78
+
.ace()
79
+
.handle(process.argv.slice(2))
80
+
.catch(console.error)
81
+
```
82
+
83
+
#### Modify `.adonisrs.json`
51
84
52
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.
0 commit comments