@@ -80,22 +80,6 @@ export async function startServer(options: z.infer<typeof StartServerSchema>) {
80
80
// Loopback fetch used by webhooks and custom routes
81
81
bindLoopbackFetch ( app ) ;
82
82
83
- if ( options . auth ?. path ) {
84
- logger . info ( `Loading auth from ${ options . auth . path } ` ) ;
85
- await registerAuth ( options . auth , { cwd : options . cwd } ) ;
86
- app . use ( auth ( ) ) ;
87
- }
88
-
89
- if ( options . http ?. app ) {
90
- logger . info ( `Loading HTTP app from ${ options . http . app } ` ) ;
91
- const { api } = await registerHttp ( options . http . app , { cwd : options . cwd } ) ;
92
- app . route ( "/" , api ) ;
93
- }
94
-
95
- app . use ( cors ( options . http ?. cors ) ) ;
96
- app . use ( requestLogger ( ) ) ;
97
- app . use ( ensureContentType ( ) ) ;
98
-
99
83
app . post (
100
84
"/internal/truncate" ,
101
85
zValidator (
@@ -117,6 +101,22 @@ export async function startServer(options: z.infer<typeof StartServerSchema>) {
117
101
} ,
118
102
) ;
119
103
104
+ if ( options . auth ?. path ) {
105
+ logger . info ( `Loading auth from ${ options . auth . path } ` ) ;
106
+ await registerAuth ( options . auth , { cwd : options . cwd } ) ;
107
+ app . use ( auth ( ) ) ;
108
+ }
109
+
110
+ if ( options . http ?. app ) {
111
+ logger . info ( `Loading HTTP app from ${ options . http . app } ` ) ;
112
+ const { api } = await registerHttp ( options . http . app , { cwd : options . cwd } ) ;
113
+ app . route ( "/" , api ) ;
114
+ }
115
+
116
+ app . use ( cors ( options . http ?. cors ) ) ;
117
+ app . use ( requestLogger ( ) ) ;
118
+ app . use ( ensureContentType ( ) ) ;
119
+
120
120
if ( ! options . http ?. disable_meta ) app . route ( "/" , meta ) ;
121
121
if ( ! options . http ?. disable_assistants ) app . route ( "/" , assistants ) ;
122
122
if ( ! options . http ?. disable_runs ) app . route ( "/" , runs ) ;
0 commit comments