Skip to content

Commit

Permalink
fix: correctly override local agent (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
so1ve committed Nov 27, 2023
1 parent 4890f32 commit 760598e
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,16 @@ let config: Config | undefined

export async function getConfig(): Promise<Config> {
if (!config) {
config = Object.assign(
{},
defaultConfig,
fs.existsSync(rcPath)
? ini.parse(fs.readFileSync(rcPath, 'utf-8'))
: null,
)
const agent = await detect({ programmatic: true })
if (agent) {
config = { ...defaultConfig, defaultAgent: agent }
}
else {
config = Object.assign(
{},
defaultConfig,
fs.existsSync(rcPath)
? ini.parse(fs.readFileSync(rcPath, 'utf-8'))
: null,
)
}
if (agent)
config.defaultAgent = agent
}

return config
Expand Down

0 comments on commit 760598e

Please sign in to comment.