Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update helpdesk logic to use Jira personal access tokens #712

Merged
merged 1 commit into from
Jan 23, 2024

Conversation

justincorrigible
Copy link
Member

@justincorrigible justincorrigible commented Jan 23, 2024

The ARGO platform contact form was borked by changes in auth management at the Helpdesk API.
Our Jira server's Basic auth now requires captchas, etc. so this app hasn't been able to submit new tix since summer 2023.

This PR changes the way we do auth to use Jira PATs (same user as before, see credentials in prod vault).
It also improves the error handling for that section of the app, so the pod doesn't crash if Jira becomes unreachable for a different reason, or similar issues arise later on.

Along the way, I've added a couple goodies:

  • improved error handling to reduce crashes in other areas (captcha, eslint clients)
  • heaps of logging (including debug mode #rejoice)
  • add ‘@/‘ to absolute paths to match current community/industry practices.

@justincorrigible justincorrigible force-pushed the contact_form branch 7 times, most recently from 47081a5 to 7c7396e Compare January 23, 2024 16:38
Copy link
Member Author

@justincorrigible justincorrigible left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

des comments for great good 💰

JIRA_ADMIN_VAULT_CREDENTIALS_PATH=
JIRA_REST_URI=
JIRA_SERVICEDESK_ID= 9
JIRA_PERSONAL_ACCESS_TOKEN= # PAT is used only when USE_VAULT is false
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this replaces the email/pass combo. basic auth will be disabled by resIT for that API soon, and new tokens can be created using the credentials found in the argo prod vault.

@@ -14,7 +14,7 @@ module.exports = {
parserOptions: {
ecmaVersion: 'latest',
extraFileExtensions: ['.json'],
project: ['./tsconfig.json'],
project: ['./tsconfig.json', './tsconfig.eslint.json'],
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this adds linting for the eslint and prettier config files themselves

@@ -47,10 +47,10 @@ module.exports = {
'prettier/prettier': [
'error',
{
printWidth: 100,
trailingComma: 'all',
printWidth: 120,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updates width. update for eslint to import prettier configs to be done in separate PR.
i.e. new api with breaking changes

.env
# only .env will actually be loaded
*.env*
!**/.env.schema
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this allows for local backup files, etc.

"patchTS": "ts-patch install -s",
"prepare": "npm run patchTS",
"programDashboardEsInit": "ts-node --project tsconfig.script.json ./compose/programDashboardEsInit.ts",
"dev": "NODE_PATH=./src NODE_ENV=development nodemon -e js,json,ts ./src/index.ts",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one is the real change here, adding nodemon.
lines bellow are just sorting

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does anyone else hear an echo?

@@ -49,9 +50,11 @@ export const createVaultClient = memoize(async (vaultOptions: VaultOptions = {})

export const loadVaultSecret =
(vaultClient: ReturnType<typeof createVaultClient> = createVaultClient()) =>
async (path: string) => {
async <T = Record<string, string>>(path: string): Promise<T> => {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

started something, didn't really finish it cognisant of scope, but should enable vault secret validation in the future

@@ -14,7 +14,8 @@
"outDir": "./dist",
"baseUrl": "./",
"paths": {
"*": ["./src/*"]
"*": ["./src/*"],
"@/*": ["./src/*"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gradual community practices adoption

"allowJs": true
},
"exclude": ["dist/**/*", "src/**/*"],
"include": [".eslintrc.js", "prettier.config.js", "**/*.json"]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

validates eslint, prettier, and eventually arranger configs

),
transports: [
new transports.Console({
handleExceptions: true,
level: isProd ? 'error' : 'debug',
level: DEBUG || !IS_PROD ? 'debug' : 'info',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

moar logs!1 #l33t

@justincorrigible justincorrigible self-assigned this Jan 23, 2024
@justincorrigible justincorrigible marked this pull request as ready for review January 23, 2024 16:41
@justincorrigible justincorrigible changed the title update helpdesk logic to use auth tokens update helpdesk logic to use Jira personal access tokens Jan 23, 2024
bonus:
- improved error handling to reduce crashes
- heaps of logging
- add ‘@/‘ to absolute paths for best practices
@justincorrigible justincorrigible merged commit 3583591 into develop Jan 23, 2024
2 checks passed
@justincorrigible justincorrigible deleted the contact_form branch January 23, 2024 17:27
justincorrigible added a commit that referenced this pull request Jan 23, 2024
bonus:
- improved error handling to reduce crashes in other areas (captcha, eslint clients)
- heaps of logging (including debug mode #rejoice)
- add ‘@/‘ to absolute paths to match current community/industry practices.
justincorrigible added a commit that referenced this pull request Jan 23, 2024
bonus:
- improved error handling to reduce crashes in other areas (captcha, eslint clients)
- heaps of logging (including debug mode #rejoice)
- add ‘@/‘ to absolute paths to match current community/industry practices.
justincorrigible added a commit that referenced this pull request Jan 23, 2024
bonus:
- improved error handling to reduce crashes in other areas (captcha, eslint clients)
- heaps of logging (including debug mode #rejoice)
- add ‘@/‘ to absolute paths to match current community/industry practices.
justincorrigible added a commit that referenced this pull request Jan 24, 2024
bonus:
- improved error handling to reduce crashes in other areas (captcha, eslint clients)
- heaps of logging (including debug mode #rejoice)
- add ‘@/‘ to absolute paths to match current community/industry practices.
justincorrigible added a commit that referenced this pull request Jan 24, 2024
bonus:
- improved error handling to reduce crashes in other areas (captcha, eslint clients)
- heaps of logging (including debug mode #rejoice)
- add ‘@/‘ to absolute paths to match current community/industry practices.
justincorrigible added a commit that referenced this pull request Jan 24, 2024
bonus:
- improved error handling to reduce crashes in other areas (captcha, eslint clients)
- heaps of logging (including debug mode #rejoice)
- add ‘@/‘ to absolute paths to match current community/industry practices.
justincorrigible added a commit that referenced this pull request Jan 24, 2024
bonus:
- improved error handling to reduce crashes in other areas (captcha, eslint clients)
- heaps of logging (including debug mode #rejoice)
- add ‘@/‘ to absolute paths to match current community/industry practices.
justincorrigible added a commit that referenced this pull request Jan 24, 2024
bonus:
- improved error handling to reduce crashes in other areas (captcha, eslint clients)
- heaps of logging (including debug mode #rejoice)
- add ‘@/‘ to absolute paths to match current community/industry practices.
justincorrigible added a commit that referenced this pull request Feb 5, 2024
bonus:
- improved error handling to reduce crashes in other areas (captcha, eslint clients)
- heaps of logging (including debug mode #rejoice)
- add ‘@/‘ to absolute paths to match current community/industry practices.

(cherry picked from commit 966fcc5)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants