File tree Expand file tree Collapse file tree 2 files changed +7
-0
lines changed
Expand file tree Collapse file tree 2 files changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ export namespace GlobalConfig {
99 autoshare : z . boolean ( ) . optional ( ) ,
1010 provider : z . string ( ) . optional ( ) ,
1111 model : z . string ( ) . optional ( ) ,
12+ disabled_providers : z . array ( z . string ( ) ) . optional ( ) ,
1213 } )
1314 export type Info = z . infer < typeof Info >
1415
Original file line number Diff line number Diff line change @@ -169,22 +169,28 @@ export namespace Provider {
169169 database [ providerID ] = parsed
170170 }
171171
172+ const disabled = await GlobalConfig . get ( ) . then (
173+ ( cfg ) => new Set ( cfg . disabled_providers ?? [ ] ) ,
174+ )
172175 // load env
173176 for ( const [ providerID , provider ] of Object . entries ( database ) ) {
177+ if ( disabled . has ( providerID ) ) continue
174178 if ( provider . env . some ( ( item ) => process . env [ item ] ) ) {
175179 mergeProvider ( providerID , { } , "env" )
176180 }
177181 }
178182
179183 // load apikeys
180184 for ( const [ providerID , provider ] of Object . entries ( await Auth . all ( ) ) ) {
185+ if ( disabled . has ( providerID ) ) continue
181186 if ( provider . type === "api" ) {
182187 mergeProvider ( providerID , { apiKey : provider . key } , "api" )
183188 }
184189 }
185190
186191 // load custom
187192 for ( const [ providerID , fn ] of Object . entries ( CUSTOM_LOADERS ) ) {
193+ if ( disabled . has ( providerID ) ) continue
188194 const result = await fn ( database [ providerID ] )
189195 if ( result ) mergeProvider ( providerID , result , "custom" )
190196 }
You can’t perform that action at this time.
0 commit comments