config-loader: switch to using --config options to load in config

This commit is contained in:
Patrik Oldsberg
2020-10-20 13:08:05 +02:00
parent ad221957cd
commit 8c2b76e45f
27 changed files with 200 additions and 302 deletions
@@ -33,7 +33,7 @@ export async function startStandaloneServer(
options: ServerOptions,
): Promise<Server> {
const logger = options.logger.child({ service: 'auth-backend' });
const config = await loadBackendConfig({ logger });
const config = await loadBackendConfig({ logger, argv: process.argv });
const discovery = SingleHostDiscovery.fromConfig(config);
const database = useHotMemoize(module, () => {
@@ -36,7 +36,7 @@ export async function startStandaloneServer(
options: ServerOptions,
): Promise<Server> {
const logger = options.logger.child({ service: 'catalog-backend' });
const config = await loadBackendConfig({ logger });
const config = await loadBackendConfig({ logger, argv: process.argv });
const reader = UrlReaders.default({ logger, config });
const db = useHotMemoize(module, () =>
DatabaseManager.createInMemoryDatabaseConnection(),
@@ -41,7 +41,7 @@ const mockCreateProxyMiddleware = createProxyMiddleware as jest.MockedFunction<
describe('createRouter', () => {
it('works', async () => {
const logger = winston.createLogger();
const config = await loadBackendConfig({ logger });
const config = await loadBackendConfig({ logger, argv: [] });
const discovery = SingleHostDiscovery.fromConfig(config);
const router = await createRouter({
config,
@@ -36,7 +36,7 @@ export async function startStandaloneServer(
logger.debug('Creating application...');
const config = await loadBackendConfig({ logger });
const config = await loadBackendConfig({ logger, argv: process.argv });
const discovery = SingleHostDiscovery.fromConfig(config);
const router = await createRouter({
config,
@@ -32,7 +32,7 @@ export async function startStandaloneServer(
options: ServerOptions,
): Promise<Server> {
const logger = options.logger.child({ service: 'rollbar-backend' });
const config = await loadBackendConfig({ logger });
const config = await loadBackendConfig({ logger, argv: process.argv });
logger.debug('Creating application...');
@@ -231,7 +231,10 @@ export const getDefaultBranch = async (
repositoryUrl: string,
): Promise<string> => {
// TODO(Rugvip): Config should not be loaded here, pass it in instead
const config = await loadBackendConfig({ logger: getRootLogger() });
const config = await loadBackendConfig({
logger: getRootLogger(),
argv: process.argv,
});
const type = getGitRepoType(repositoryUrl);
try {