Skip to content

Commit ae396a8

Browse files
committed
chore: update readme file
1 parent 9d6ff90 commit ae396a8

File tree

1 file changed

+39
-6
lines changed

1 file changed

+39
-6
lines changed

README.md

+39-6
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
- [Adonis Credentials](#adonis-credentials)
66
- [Installation](#installation)
7+
- [Configuration](#configuration)
8+
- [Run `ace configure`](#run-ace-configure)
9+
- [Modify `server.ts` file](#modify-serverts-file)
10+
- [Modify `ace` file](#modify-ace-file)
11+
- [Modify `.adonisrs.json`](#modify-adonisrsjson)
712
- [Usage](#usage)
813
- [Creating credentials](#creating-credentials)
914
- [Editing credentials](#editing-credentials)
@@ -17,8 +22,7 @@
1722
1823
[![workflow-image]][workflow-url] [![npm-image]][npm-url] [![license-image]][license-url] [![typescript-image]][typescript-url]
1924

20-
Adonis Credentials is created to help manage multiple environment secrets, share them securely and even keep them inside your repo.
21-
It is heavily insiped by [Rails Credentials](https://edgeguides.rubyonrails.org/security.html#environmental-security).
25+
Adonis Credentials is created to help manage multiple environment secrets, share them securely and even keep them inside your repo.
2226

2327
## Installation
2428

@@ -29,25 +33,54 @@ npm install @bitkidd/adonis-credentials
2933
yarn add @bitkidd/adonis-credentials
3034
```
3135

32-
And then:
36+
## Configuration
37+
38+
To configure credentials provider, we should proceed with 4 steps:
39+
40+
#### Run `ace configure`
41+
3342
```
3443
node ace configure @bitkidd/adonis-credentials
3544
```
3645

3746
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
3850

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`:
4052

4153
```ts
54+
// This goes on top, where import declarations are
4255
import { Credentials } from '@bitkidd/adonis-credentials/build/src/Credentials'
4356

4457
// ...
4558

46-
new Credentials().initialize() // <--- Here
59+
new Credentials().initialize() // <--- Insert credentials initialization here, before the Ignitor
4760
new Ignitor(__dirname).httpServer().start().catch(console.error)
4861
```
4962

50-
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
72+
const { Credentials } = require('@bitkidd/adonis-credentials/build/src/Credentials')
73+
74+
// ...
75+
76+
new Credentials().initialize() // <--- Insert credentials initialization here, before the Ignitor
77+
new Ignitor(__dirname)
78+
.ace()
79+
.handle(process.argv.slice(2))
80+
.catch(console.error)
81+
```
82+
83+
#### Modify `.adonisrs.json`
5184

5285
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.
5386

0 commit comments

Comments
 (0)