2022-01-11 22:28:37 +00:00
|
|
|
import ENV from 'vault/config/environment';
|
|
|
|
import handlers from './handlers';
|
2021-06-07 17:44:39 +00:00
|
|
|
|
2021-12-17 03:44:29 +00:00
|
|
|
export default function () {
|
2020-11-09 15:41:19 +00:00
|
|
|
this.namespace = 'v1';
|
|
|
|
|
2022-01-11 22:28:37 +00:00
|
|
|
// start ember in development running mirage -> yarn start:mirage handlerName
|
|
|
|
// if handler is not provided, general config will be used
|
|
|
|
// this is useful for feature development when a specific and limited config is required
|
|
|
|
const { handler } = ENV['ember-cli-mirage'];
|
|
|
|
const handlerName = handler in handlers ? handler : 'base';
|
|
|
|
handlers[handlerName](this);
|
|
|
|
this.logging = false; // disables passthrough logging which spams the console
|
|
|
|
console.log(`⚙ Using ${handlerName} Mirage request handlers ⚙`); // eslint-disable-line
|
|
|
|
// passthrough all unhandled requests
|
2020-11-09 15:41:19 +00:00
|
|
|
this.passthrough();
|
|
|
|
}
|