2021-05-22 06:56:37 +02:00
|
|
|
import path from 'path';
|
|
|
|
import buildDebug from 'debug';
|
|
|
|
import { parseConfigFile } from '@verdaccio/config';
|
|
|
|
import { setup, logger } from '@verdaccio/logger';
|
|
|
|
import server from '../src/index';
|
|
|
|
|
|
|
|
const debug = buildDebug('verdaccio:fastify:debug');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This file is intended for fast development and debug, it should
|
|
|
|
* be removed eventually and the app start from @verdaccio/cli package.
|
|
|
|
*/
|
|
|
|
(async () => {
|
|
|
|
try {
|
|
|
|
const configFile = path.join(__dirname, './fastify-conf.yaml');
|
|
|
|
debug('configFile %s', configFile);
|
|
|
|
const configParsed = parseConfigFile(configFile);
|
|
|
|
setup(configParsed.log);
|
|
|
|
logger.info(`config location ${configFile}`);
|
|
|
|
debug('configParsed %s', configParsed);
|
|
|
|
process.title = 'fastify-verdaccio';
|
2021-06-13 22:03:09 +02:00
|
|
|
const ser = await server({ logger, config: configParsed });
|
2021-05-22 06:56:37 +02:00
|
|
|
await ser.listen(4873);
|
|
|
|
logger.info('fastify running on port 4873');
|
|
|
|
} catch (err) {
|
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.error(err);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
})();
|