@bella-baxter/adonis 0.1.1-preview.11 → 0.1.1-preview.111
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +86 -0
- package/package.json +13 -3
package/README.md
ADDED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# @bella-baxter/adonis
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@bella-baxter/adonis)
|
|
4
|
+
[](LICENSE)
|
|
5
|
+
|
|
6
|
+
[Bella Baxter](https://github.com/Cosmic-Chimps/bella-baxter) service provider for AdonisJS v6/v7 — registers `BellaService` in the IoC container for live-reloading secrets.
|
|
7
|
+
|
|
8
|
+
## Installation
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npm install @bella-baxter/adonis
|
|
12
|
+
# or
|
|
13
|
+
pnpm add @bella-baxter/adonis
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Setup
|
|
17
|
+
|
|
18
|
+
### 1. Register the provider
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
// adonisrc.ts
|
|
22
|
+
import { defineConfig } from '@adonisjs/core/build/config.js';
|
|
23
|
+
|
|
24
|
+
export default defineConfig({
|
|
25
|
+
providers: [
|
|
26
|
+
() => import('@bella-baxter/adonis'),
|
|
27
|
+
],
|
|
28
|
+
});
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### 2. Create the config file
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// config/bella.ts
|
|
35
|
+
import env from '#start/env'
|
|
36
|
+
import type { BellaConfigOptions } from '@bella-baxter/adonis';
|
|
37
|
+
|
|
38
|
+
const bellaConfig: BellaConfigOptions = {
|
|
39
|
+
baxterUrl: env.get('BELLA_BAXTER_URL'),
|
|
40
|
+
apiKey: env.get('BELLA_BAXTER_API_KEY'),
|
|
41
|
+
projectSlug: env.get('BELLA_BAXTER_PROJECT', 'my-app'),
|
|
42
|
+
environmentSlug: env.get('BELLA_BAXTER_ENV', 'production'),
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export default bellaConfig;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### 3. Inject in controllers / services
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
import { inject } from '@adonisjs/core';
|
|
52
|
+
import { BellaService } from '@bella-baxter/adonis';
|
|
53
|
+
|
|
54
|
+
@inject()
|
|
55
|
+
export default class SecretsController {
|
|
56
|
+
constructor(protected bella: BellaService) {}
|
|
57
|
+
|
|
58
|
+
async show() {
|
|
59
|
+
return { dbUrl: this.bella.getOrThrow('DATABASE_URL') }
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Typed secrets
|
|
65
|
+
|
|
66
|
+
Run `bella secrets generate typescript --declaration` to generate `bella-secrets.d.ts`. The `BellaService` proxy picks up the augmented `BellaSecrets` interface:
|
|
67
|
+
|
|
68
|
+
```ts
|
|
69
|
+
this.bella.DATABASE_URL // string — typed!
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Environment variables
|
|
73
|
+
|
|
74
|
+
| Variable | Description |
|
|
75
|
+
|----------|-------------|
|
|
76
|
+
| `BELLA_BAXTER_URL` | Base URL of the Bella Baxter API |
|
|
77
|
+
| `BELLA_BAXTER_API_KEY` | API key (`bax-...`) |
|
|
78
|
+
| `BELLA_BAXTER_PROJECT` | Project slug |
|
|
79
|
+
| `BELLA_BAXTER_ENV` | Environment slug |
|
|
80
|
+
| `BELLA_BAXTER_PRIVATE_KEY` | Private key for ZKE (optional) |
|
|
81
|
+
|
|
82
|
+
## Links
|
|
83
|
+
|
|
84
|
+
- [GitHub](https://github.com/Cosmic-Chimps/bella-baxter)
|
|
85
|
+
- [Issues](https://github.com/Cosmic-Chimps/bella-baxter/issues)
|
|
86
|
+
- [Core SDK](https://www.npmjs.com/package/@bella-baxter/sdk)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bella-baxter/adonis",
|
|
3
|
-
"version": "0.1.1-preview.
|
|
3
|
+
"version": "0.1.1-preview.111",
|
|
4
4
|
"description": "Bella Baxter AdonisJS v6 service provider — registers BellaService in the IoC container",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -12,16 +12,17 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
+
"README.md",
|
|
15
16
|
"dist"
|
|
16
17
|
],
|
|
17
18
|
"dependencies": {
|
|
18
|
-
"@bella-baxter/sdk": "0.1.1-preview.
|
|
19
|
+
"@bella-baxter/sdk": "0.1.1-preview.111"
|
|
19
20
|
},
|
|
20
21
|
"peerDependencies": {
|
|
21
22
|
"@adonisjs/core": ">=6"
|
|
22
23
|
},
|
|
23
24
|
"devDependencies": {
|
|
24
|
-
"typescript": "^
|
|
25
|
+
"typescript": "^6.0.2",
|
|
25
26
|
"@types/node": "^25.5.0"
|
|
26
27
|
},
|
|
27
28
|
"keywords": [
|
|
@@ -31,6 +32,15 @@
|
|
|
31
32
|
"adonis"
|
|
32
33
|
],
|
|
33
34
|
"license": "MIT",
|
|
35
|
+
"repository": {
|
|
36
|
+
"type": "git",
|
|
37
|
+
"url": "https://github.com/Cosmic-Chimps/bella-baxter-js.git",
|
|
38
|
+
"directory": "apps/sdk/js/packages/adonis"
|
|
39
|
+
},
|
|
40
|
+
"homepage": "https://github.com/Cosmic-Chimps/bella-baxter-js/tree/main/packages/adonis#readme",
|
|
41
|
+
"bugs": {
|
|
42
|
+
"url": "https://github.com/Cosmic-Chimps/bella-baxter-js/issues"
|
|
43
|
+
},
|
|
34
44
|
"scripts": {
|
|
35
45
|
"build": "tsc",
|
|
36
46
|
"typecheck": "tsc --noEmit"
|