Skip to content

Commit 97ce8ab

Browse files
committed
fix: add some more info to configuration phase arguments
1 parent df748fc commit 97ce8ab

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

src/express-app/app.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,13 @@ export async function startApp<
9797
assert(serviceImpl?.start, 'Service function did not return a conforming object');
9898

9999
const sourceDirectory = path.join(rootDirectory, codepath);
100+
const codeExtension = codepath === 'src' ? '.ts' : '.js';
101+
100102
const baseOptions: ServiceOptions = {
101103
configurationDirectories: [path.resolve(rootDirectory, './config')],
102104
shortstopHandlers: shortstops({ name }, sourceDirectory),
105+
codepath,
106+
codeExtension,
103107
};
104108
const options = serviceImpl.configure?.(startOptions, baseOptions) || baseOptions;
105109

src/types.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,11 @@ export interface DelayLoadServiceStartOptions extends Omit<ServiceStartOptions,
143143

144144
// Handled by service.configure
145145
export interface ServiceOptions {
146+
// Used to resolve code paths flexibly during dev/prod
147+
codepath: string;
148+
// Will be either .ts or .js depending on the runtime environment
149+
codeExtension: string;
150+
146151
// If you need multiple configuration directories, pass them here
147152
// in the desired order (later trumps earlier)
148153
configurationDirectories: string[];

0 commit comments

Comments
 (0)