Skip to content

Commit 406911c

Browse files
authored
refactor: use getAPIToken from @netlify/dev-utils (#7469)
1 parent e963056 commit 406911c

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/utils/command-helpers.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import process from 'process'
44
import { format, inspect } from 'util'
55

66
import type { NetlifyAPI } from '@netlify/api'
7-
import { getGlobalConfigStore } from '@netlify/dev-utils'
7+
import { getAPIToken } from '@netlify/dev-utils'
88
import { Chalk } from 'chalk'
99
import WSL from 'is-wsl'
1010
import terminalLink from 'terminal-link'
@@ -138,9 +138,7 @@ export const getToken = async (tokenFromOptions?: string): Promise<TokenTuple> =
138138
return [NETLIFY_AUTH_TOKEN, 'env']
139139
}
140140
// 3. If no env var use global user setting
141-
const globalConfig = await getGlobalConfigStore()
142-
const userId = globalConfig.get('userId')
143-
const tokenFromConfig = globalConfig.get(`users.${userId}.auth.token`)
141+
const tokenFromConfig = await getAPIToken()
144142
if (tokenFromConfig) {
145143
return [tokenFromConfig, 'config']
146144
}

0 commit comments

Comments
 (0)