Skip to content

Instantly share code, notes, and snippets.

@john-osullivan
Last active November 7, 2019 18:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save john-osullivan/6a04b4cde1b47547beb25f4e170c6dd3 to your computer and use it in GitHub Desktop.
Save john-osullivan/6a04b4cde1b47547beb25f4e170c6dd3 to your computer and use it in GitHub Desktop.
Dev Diaries #3 - Middleware for Default Auth Path
// 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