File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,7 @@ export type InitOptions = {
108108 * See Pino Docs for options: https://getpino.io/#/docs/api?id=options
109109 */
110110 loggerOptions ?: LoggerOptions ;
111+ config ?: SanitizedConfig
111112} ;
112113
113114/**
Original file line number Diff line number Diff line change 11/* eslint-disable no-param-reassign */
22import express , { NextFunction , Response } from 'express' ;
33import crypto from 'crypto' ;
4+ import path from 'path' ;
45import mongoose from 'mongoose' ;
56import { InitOptions } from './config/types' ;
67
@@ -30,6 +31,7 @@ import Logger from './utilities/logger';
3031import { getDataLoader } from './collections/dataloader' ;
3132import mountEndpoints from './express/mountEndpoints' ;
3233import PreferencesModel from './preferences/model' ;
34+ import findConfig from './config/find' ;
3335
3436export const init = ( payload : Payload , options : InitOptions ) : void => {
3537 payload . logger . info ( 'Starting Payload...' ) ;
@@ -52,7 +54,21 @@ export const init = (payload: Payload, options: InitOptions): void => {
5254
5355 payload . local = options . local ;
5456
55- payload . config = loadConfig ( payload . logger ) ;
57+ if ( options . config ) {
58+ payload . config = options . config ;
59+ const configPath = findConfig ( ) ;
60+
61+ payload . config = {
62+ ...options . config ,
63+ paths : {
64+ configDir : path . dirname ( configPath ) ,
65+ config : configPath ,
66+ rawConfig : configPath ,
67+ } ,
68+ } ;
69+ } else {
70+ payload . config = loadConfig ( payload . logger ) ;
71+ }
5672
5773 // If not initializing locally, scaffold router
5874 if ( ! payload . local ) {
You can’t perform that action at this time.
0 commit comments