2021-05-21 23:56:37 -05:00
|
|
|
import buildDebug from 'debug';
|
2021-10-29 10:33:05 -05:00
|
|
|
import path from 'path';
|
|
|
|
|
2021-05-21 23:56:37 -05:00
|
|
|
import { parseConfigFile } from '@verdaccio/config';
|
2021-10-29 10:33:05 -05:00
|
|
|
import { logger, setup } from '@verdaccio/logger';
|
|
|
|
|
2021-05-21 23:56:37 -05:00
|
|
|
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 15:03:09 -05:00
|
|
|
const ser = await server({ logger, config: configParsed });
|
2021-05-21 23:56:37 -05:00
|
|
|
await ser.listen(4873);
|
|
|
|
logger.info('fastify running on port 4873');
|
2021-08-30 01:19:08 -05:00
|
|
|
} catch (err: any) {
|
2021-05-21 23:56:37 -05:00
|
|
|
// eslint-disable-next-line no-console
|
|
|
|
console.error(err);
|
|
|
|
process.exit(1);
|
|
|
|
}
|
|
|
|
})();
|