Last active
November 7, 2019 18:23
-
-
Save john-osullivan/6a04b4cde1b47547beb25f4e170c6dd3 to your computer and use it in GitHub Desktop.
Dev Diaries #3 - Middleware for Default Auth Path
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
// Middleware defined in a service file | |
export function addDefaultAuthPath(args:ArgShape): ArgShape { | |
if (args.authPath) return args; | |
args.authPath = AUTH_FILE_PATH; | |
initAuthFile(); | |
return args; | |
} | |
// Then used in cli.tsx | |
yargs | |
.options(...) | |
.middleware(addDefaultAuthPath) | |
.middleware(loadFileFromPath) | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment