mirror of
https://github.com/verdaccio/verdaccio.git
synced 2025-01-06 22:40:26 -05:00
f047cc8c25
* refactor: auth with legacy sign support refactor: auth with legacy sign support add tests add tests clean up lock fil clean up lock fil add more ci to test update ci update ci update ci update ci update ci * chore: add test for deprecated legacy signature * chore: add test for deprecated legacy signature * chore: add test for deprecated legacy signature * chore: add test for deprecated legacy signature * chore: add test for deprecated legacy signature
29 lines
918 B
TypeScript
29 lines
918 B
TypeScript
import { Application } from 'express';
|
|
import path from 'path';
|
|
|
|
import { parseConfigFile } from '@verdaccio/config';
|
|
import { fileUtils } from '@verdaccio/core';
|
|
import { setup } from '@verdaccio/logger';
|
|
import { generateRandomHexString } from '@verdaccio/utils';
|
|
|
|
import apiMiddleware from '../src';
|
|
|
|
setup({});
|
|
|
|
export const getConf = async (conf) => {
|
|
const configPath = path.join(__dirname, 'config', conf);
|
|
const config = parseConfigFile(configPath);
|
|
// generate and create storage folder
|
|
const storage = await fileUtils.createTempFolder('config');
|
|
config.storage = storage;
|
|
// custom config to avoid conflict with other tests
|
|
config.auth.htpasswd.file = path.join(
|
|
storage,
|
|
`${config.auth.htpasswd.file}-${generateRandomHexString()}`
|
|
);
|
|
return config;
|
|
};
|
|
|
|
export async function initializeServer(configName): Promise<Application> {
|
|
return apiMiddleware(await getConf(configName));
|
|
}
|