mirror of
https://github.com/verdaccio/verdaccio.git
synced 2024-12-23 22:27:34 -05:00
22 lines
672 B
TypeScript
22 lines
672 B
TypeScript
import buildDebug from 'debug';
|
|
import path from 'path';
|
|
|
|
import { parseConfigFile } from '@verdaccio/config';
|
|
|
|
const debug = buildDebug('verdaccio:mock:config');
|
|
|
|
/**
|
|
* Override the default.yaml configuration file with any new config provided.
|
|
*/
|
|
function configExample(externalConfig: any = {}, configFile?: string, location?: string) {
|
|
let config = {};
|
|
if (location && configFile) {
|
|
const locationFile = path.join(location, configFile);
|
|
debug('config location: %s', locationFile);
|
|
config = parseConfigFile(locationFile);
|
|
debug('config file: %o', JSON.stringify(config));
|
|
}
|
|
return { ...externalConfig, ...config };
|
|
}
|
|
|
|
export { configExample };
|