open-vault/ui/mirage/config.js
Jordan Reimer 3553e223ca
Mirage Dev Workflow (#13620)
* adds development workflow to mirage config

* adds example mirage dev handler

* adds changelog

* removes changelog entry

* adds base mirage handlers
2022-01-11 15:28:37 -07:00

18 lines
745 B
JavaScript

import ENV from 'vault/config/environment';
import handlers from './handlers';
export default function () {
this.namespace = 'v1';
// 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
this.passthrough();
}