Skip to content

Commit

Permalink
Merge pull request #5 from fabrix-app/v1.6
Browse files Browse the repository at this point in the history
[feat] Archetype integration testing
  • Loading branch information
scott-wyatt authored Dec 19, 2018
2 parents c439c9b + b24c5d3 commit 1121046
Show file tree
Hide file tree
Showing 7 changed files with 422 additions and 397 deletions.
111 changes: 0 additions & 111 deletions lib/archetype/config/engine.ts

This file was deleted.

56 changes: 56 additions & 0 deletions lib/archetype/config/tasks.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/**
* Engine Configuration
*
* @see {@link http://
*/
export const tasks = {
prefix: null,
live_mode: true,
auto_save: false,
/**
* Set profile to subscribe to tasks in the matching profile (tasks.profiles).
* If process.env.TASKS_PROFILE does not match a profile, the application will not subscribe to any tasks
*/
profile: process.env.TASKS_PROFILE || null,
// enabled: true,
auto_queue: true,
connection: {
// optional, defaults to `tasks-work-x`
exchange: process.env.TASKS_EXCHANGE || null,
// optional, defaults to `tasks-work-q`
work_queue_name: process.env.TASKS_WORK_QUEUE || null,
// optional, defaults to `tasks-interrupt-q`
interrupt_queue_name: process.env.TASKS_INTERRUPT_QUEUE || null,

/**
* The RabbitMQ connection information.
* See: https://www.rabbitmq.com/uri-spec.html
*/
host: process.env.TASKS_RMQ_HOST || null,
user: process.env.TASKS_RMQ_USER || null,
pass: process.env.TASKS_RMQ_PASS || null,
port: process.env.TASKS_RMQ_PORT || null,
vhost: process.env.TASKS_RMQ_VHOST || null,
/**
* Connection information could also be passed via uri
*/
uri: process.env.TASKS_RMQ_URI || null,
/**
* Additional, optional connection options (default values shown)
*/
heartbeat: 30,
/**
* this is the connection timeout (in milliseconds, per connection attempt), and there is no default
*/
timeout: null,
/**
* limits how long rabbot will attempt to connect (in seconds, across all connection attempts). Defaults to 60
*/
failAfter: 60,
/**
* limits number of consecutive failed attempts
*/
retryLimit: 3,
},
profiles: {}
}
51 changes: 1 addition & 50 deletions lib/config/routes.ts
Original file line number Diff line number Diff line change
@@ -1,52 +1,3 @@
import * as joi from 'joi'
export const routes = {
'/events': {
'GET': 'EventController.findAll',
config: {
prefix: 'engine.prefix',
validate: {
query: {
offset: joi.number(),
limit: joi.number(),
where: joi.object(),
sort: joi.array().items(joi.array()),
}
},
app: {
permissions: {
resource_name: 'apiGetEventsRoute',
roles: ['admin']
}
}
}
},
'/event': {
'POST': 'EventController.create',
config: {
prefix: 'engine.prefix',
app: {
permissions: {
resource_name: 'apiPostEventRoute',
roles: ['admin']
}
}
}
},
'/event/:id': {
'GET': 'EventController.findOne',
config: {
prefix: 'engine.prefix',
validate: {
params: {
id: joi.string().required()
}
},
app: {
permissions: {
resource_name: 'apiGetEventIdRoute',
roles: ['admin']
}
}
}
}

}
6 changes: 3 additions & 3 deletions lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export const Utils = {
* @returns {object} - taskerConfig
*/
configureExchangesAndQueues: (profile, taskerConfig) => {
const exchangeName = taskerConfig.exchange || 'tasker-work-x'
const workQueueName = taskerConfig.work_queue_name || 'tasker-work-q'
const interruptQueueName = taskerConfig.interrupt_queue_name || 'tasker-interrupt-q'
const exchangeName = taskerConfig.exchange || 'tasks-work-x'
const workQueueName = taskerConfig.work_queue_name || 'tasks-work-q'
const interruptQueueName = taskerConfig.interrupt_queue_name || 'tasks-interrupt-q'

taskerConfig.exchangeName = exchangeName

Expand Down
Loading

0 comments on commit 1121046

Please sign in to comment.