mirror of
https://github.com/hashicorp/vault.git
synced 2025-08-18 21:21:06 +02:00
* Update mirage config * Update ember-cli-mirage and imports * bump ember-cli-mirage to latest * add lock file
37 lines
959 B
JavaScript
37 lines
959 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
import { createServer } from 'miragejs';
|
|
import { discoverEmberDataModels } from 'ember-cli-mirage';
|
|
import ENV from 'vault/config/environment';
|
|
import handlers from './handlers';
|
|
// remember to export handler name from mirage/handlers/index.js file
|
|
|
|
export default function (config) {
|
|
const finalConfig = {
|
|
...config,
|
|
logging: false,
|
|
models: {
|
|
...discoverEmberDataModels(config.store),
|
|
...config.models,
|
|
},
|
|
routes,
|
|
};
|
|
|
|
return createServer(finalConfig);
|
|
}
|
|
|
|
function routes() {
|
|
this.namespace = 'v1';
|
|
|
|
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
|
|
|
|
this.passthrough();
|
|
}
|