-
Notifications
You must be signed in to change notification settings - Fork 26
/
configure.ts
37 lines (31 loc) · 1.02 KB
/
configure.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
/**
* @rlanz/bull-queue
*
* @license MIT
* @copyright Romain Lanz <[email protected]>
*/
import { stubsRoot } from './stubs/index.js'
import type Configure from '@adonisjs/core/commands/configure'
export async function configure(command: Configure) {
const codemods = await command.createCodemods()
// Publish config file
await codemods.makeUsingStub(stubsRoot, 'config/queue.stub', {})
// Add environment variables
await codemods.defineEnvVariables({
QUEUE_REDIS_HOST: '127.0.0.1',
QUEUE_REDIS_PORT: '6379',
QUEUE_REDIS_PASSWORD: '',
})
await codemods.defineEnvValidations({
variables: {
QUEUE_REDIS_HOST: `Env.schema.string({ format: 'host' })`,
QUEUE_REDIS_PORT: 'Env.schema.number()',
QUEUE_REDIS_PASSWORD: 'Env.schema.string.optional()',
},
leadingComment: 'Variables for @rlanz/bull-queue',
})
// Add provider to rc file
await codemods.updateRcFile((rcFile) => {
rcFile.addProvider('@rlanz/bull-queue/queue_provider').addCommand('@rlanz/bull-queue/commands')
})
}