This commit is contained in:
GitMurf 2025-07-07 13:30:45 +02:00 committed by GitHub
commit cd29284ac0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 1 deletions

View file

@ -16,7 +16,12 @@ export namespace Auth {
key: z.string(),
})
export const Info = z.discriminatedUnion("type", [Oauth, Api])
export const Env = z.object({
type: z.literal("env"),
env: z.string(),
})
export const Info = z.discriminatedUnion("type", [Oauth, Api, Env])
export type Info = z.infer<typeof Info>
const filepath = path.join(Global.Path.data, "auth.json")

View file

@ -330,6 +330,12 @@ export namespace Provider {
if (provider.type === "api") {
mergeProvider(providerID, { apiKey: provider.key }, "api")
}
if (provider.type === "env") {
const envValue = process.env[provider.env]
if (envValue) {
mergeProvider(providerID, { apiKey: envValue }, "env")
}
}
}
// load custom