-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor config paths, fix CLI options (#865)
fix: Honor CLI overrides for config file paths. Reworks config paths -- removes PathProxy, fixes a few issues with CLI overrides not being honored.
- Loading branch information
Showing
18 changed files
with
185 additions
and
312 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,16 @@ | ||
import {Conf} from '../conf.js'; | ||
import {DOTFILE} from '../dotfile.js'; | ||
import {hasOauthClientSettings} from '../utils.js'; | ||
import fs from 'fs-extra'; | ||
|
||
const {auth} = Conf.get(); | ||
const config = Conf.get(); | ||
|
||
/** | ||
* Logs out the user by deleting credentials. | ||
*/ | ||
export default async (): Promise<void> => { | ||
let previousPath: string | undefined; | ||
|
||
if (hasOauthClientSettings(true)) { | ||
if (auth.isDefault()) { | ||
// If no local auth defined, try current directory | ||
previousPath = auth.path; | ||
auth.path = '.'; | ||
} | ||
|
||
await DOTFILE.AUTH().delete(); | ||
|
||
if (previousPath) { | ||
auth.path = previousPath; | ||
} | ||
if (config.auth && fs.existsSync(config.auth)) { | ||
fs.unlinkSync(config.auth); | ||
} | ||
|
||
if (hasOauthClientSettings()) { | ||
if (!auth.isDefault()) { | ||
// If local auth defined, try with default (global) | ||
previousPath = auth.path; | ||
auth.path = ''; | ||
} | ||
|
||
await DOTFILE.AUTH().delete(); | ||
|
||
if (previousPath) { | ||
auth.path = previousPath; | ||
} | ||
if (config.authLocal && fs.existsSync(config.authLocal)) { | ||
fs.unlinkSync(config.authLocal); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.