diff --git a/.circleci/config.yml b/.circleci/config.yml index b4d29758..2f699ba2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -156,7 +156,7 @@ workflows: # jira_env_type: staging # context: # - hmpps-common-vars -# - hmpps-template-typescript-preprod +# - hmpps-authorization-preprod # requires: # - request-preprod-approval # helm_timeout: 5m @@ -173,7 +173,7 @@ workflows: # slack_channel_name: << pipeline.parameters.releases-slack-channel >> # context: # - hmpps-common-vars -# - hmpps-template-typescript-prod +# - hmpps-authorization-prod # requires: # - request-prod-approval # helm_timeout: 5m @@ -181,7 +181,7 @@ workflows: security: triggers: - schedule: - cron: "30 5 * * 1-5" + cron: "39 9 * * 1-5" filters: branches: only: @@ -207,7 +207,7 @@ workflows: security-weekly: triggers: - schedule: - cron: "0 5 * * 1" + cron: "56 9 * * 1" filters: branches: only: diff --git a/.github/workflows/rename_template_project_pr.yml b/.github/workflows/rename_template_project_pr.yml deleted file mode 100644 index fc204844..00000000 --- a/.github/workflows/rename_template_project_pr.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: rename-project-create-pr - -on: [workflow_dispatch] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - - name: Run rename-project script - run: ./rename-project.bash ${{ github.event.repository.name }} - - - name: Delete this github actions workflow - run: rm .github/workflows/rename_template_project* - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v5 - with: - commit-message: updating project name after deployment from template repository - title: Update template project name/references - body: Update all references to project name after deploying from template repository - branch: rename_template_project - base: main diff --git a/CHANGELOG.md b/CHANGELOG.md index 863422d6..a0a01bd9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,7 @@ It's not safe to retry idempotent calls as this introduces the risk of creating multiple resources. This fix changes the default to not carry out any retries but allows switching on retrying if desired. -PR: [here](https://github.com/ministryofjustice/hmpps-template-typescript/pull/197) +PR: [here](https://github.com/ministryofjustice/hmpps-authorization/pull/197) --- @@ -12,7 +12,7 @@ PR: [here](https://github.com/ministryofjustice/hmpps-template-typescript/pull/1 Asset caching was only set to 20 seconds. This fix changes the default to 1 hour which has a profound effect on the number of requests the application serves. -PR: [here](https://github.com/ministryofjustice/hmpps-template-typescript/pull/178) +PR: [here](https://github.com/ministryofjustice/hmpps-authorization/pull/178) --- @@ -20,7 +20,7 @@ PR: [here](https://github.com/ministryofjustice/hmpps-template-typescript/pull/1 There was an additional unnecessary build step as part of start:dev npm task. This more than doubled the start time on the initial run. -PR: [here](https://github.com/ministryofjustice/hmpps-template-typescript/pull/172) +PR: [here](https://github.com/ministryofjustice/hmpps-authorization/pull/172) --- @@ -28,7 +28,7 @@ PR: [here](https://github.com/ministryofjustice/hmpps-template-typescript/pull/1 Updates the Content Security Policy to fix issues when users would be stuck on pages after submitting a form after their session times out. (Lots more detail in the PR) -PR: [here](https://github.com/ministryofjustice/hmpps-template-typescript/pull/170) +PR: [here](https://github.com/ministryofjustice/hmpps-authorization/pull/170) --- @@ -36,4 +36,4 @@ PR: [here](https://github.com/ministryofjustice/hmpps-template-typescript/pull/1 Multibuild docker images ended up taking a very long time after the upgrade to node 18 (1hr+). Some work needs to be done to move to support multi host builds in our circle orb, in the meantime we’ve removed this and are just building images solely for deployment. -PR: [here](https://github.com/ministryofjustice/hmpps-template-typescript/pull/149) \ No newline at end of file +PR: [here](https://github.com/ministryofjustice/hmpps-authorization/pull/149) \ No newline at end of file diff --git a/README.md b/README.md index 7f3fb4fe..85ff3e61 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# hmpps-template-typescript -[![repo standards badge](https://img.shields.io/badge/dynamic/json?color=blue&style=flat&logo=github&label=MoJ%20Compliant&query=%24.result&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fhmpps-template-typescript)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-github-repositories.html#hmpps-template-typescript "Link to report") -[![CircleCI](https://circleci.com/gh/ministryofjustice/hmpps-template-typescript/tree/main.svg?style=svg)](https://circleci.com/gh/ministryofjustice/hmpps-template-typescript) +# hmpps-authorization +[![repo standards badge](https://img.shields.io/badge/dynamic/json?color=blue&style=flat&logo=github&label=MoJ%20Compliant&query=%24.result&url=https%3A%2F%2Foperations-engineering-reports.cloud-platform.service.justice.gov.uk%2Fapi%2Fv1%2Fcompliant_public_repositories%2Fhmpps-authorization)](https://operations-engineering-reports.cloud-platform.service.justice.gov.uk/public-github-repositories.html#hmpps-authorization "Link to report") +[![CircleCI](https://circleci.com/gh/ministryofjustice/hmpps-authorization/tree/main.svg?style=svg)](https://circleci.com/gh/ministryofjustice/hmpps-authorization) Template github repo used for new Typescript based projects. @@ -12,7 +12,7 @@ see https://github.com/ministryofjustice/dps-project-bootstrap. This bootstrap is community managed by the mojdt `#typescript` slack channel. Please raise any questions or queries there. Contributions welcome! -Our security policy is located [here](https://github.com/ministryofjustice/hmpps-template-typescript/security/policy). +Our security policy is located [here](https://github.com/ministryofjustice/hmpps-authorization/security/policy). More information about the template project including features can be found [here](https://dsdmoj.atlassian.net/wiki/spaces/NDSS/pages/3488677932/Typescript+template+project). @@ -20,7 +20,7 @@ More information about the template project including features can be found [her When deploying to a new namespace, you may wish to use this template typescript project namespace as the basis for your new namespace: - + This template namespace includes an AWS elasticache setup - which is required by this template project. diff --git a/helm_deploy/hmpps-template-typescript/.helmignore b/helm_deploy/hmpps-authorization/.helmignore similarity index 100% rename from helm_deploy/hmpps-template-typescript/.helmignore rename to helm_deploy/hmpps-authorization/.helmignore diff --git a/helm_deploy/hmpps-template-typescript/Chart.yaml b/helm_deploy/hmpps-authorization/Chart.yaml similarity index 91% rename from helm_deploy/hmpps-template-typescript/Chart.yaml rename to helm_deploy/hmpps-authorization/Chart.yaml index 39f52b54..c920d722 100644 --- a/helm_deploy/hmpps-template-typescript/Chart.yaml +++ b/helm_deploy/hmpps-authorization/Chart.yaml @@ -1,7 +1,7 @@ apiVersion: v2 appVersion: '1.0' description: A Helm chart for Kubernetes -name: hmpps-template-typescript +name: hmpps-authorization version: 0.2.0 dependencies: - name: generic-service diff --git a/helm_deploy/hmpps-template-typescript/values.yaml b/helm_deploy/hmpps-authorization/values.yaml similarity index 88% rename from helm_deploy/hmpps-template-typescript/values.yaml rename to helm_deploy/hmpps-authorization/values.yaml index 5eccd1a5..123c7d7c 100644 --- a/helm_deploy/hmpps-template-typescript/values.yaml +++ b/helm_deploy/hmpps-authorization/values.yaml @@ -1,18 +1,18 @@ --- generic-service: - nameOverride: hmpps-template-typescript + nameOverride: hmpps-authorization replicaCount: 4 image: - repository: quay.io/hmpps/hmpps-template-typescript + repository: quay.io/hmpps/hmpps-authorization tag: app_version # override at deployment time port: 3000 ingress: enabled: true host: app-hostname.local # override per environment - tlsSecretName: hmpps-template-typescript-cert + tlsSecretName: hmpps-authorization-cert livenessProbe: httpGet: @@ -41,7 +41,7 @@ generic-service: # [name of environment variable as seen by app]: [key of kubernetes secret to load] namespace_secrets: - hmpps-template-typescript: + hmpps-authorization: APPINSIGHTS_INSTRUMENTATIONKEY: "APPINSIGHTS_INSTRUMENTATIONKEY" API_CLIENT_ID: "API_CLIENT_ID" API_CLIENT_SECRET: "API_CLIENT_SECRET" @@ -63,4 +63,4 @@ generic-service: cloudplatform-live-3: "35.177.252.54/32" generic-prometheus-alerts: - targetApplication: hmpps-template-typescript + targetApplication: hmpps-authorization diff --git a/helm_deploy/values-dev.yaml b/helm_deploy/values-dev.yaml index 07f57708..a8382b57 100644 --- a/helm_deploy/values-dev.yaml +++ b/helm_deploy/values-dev.yaml @@ -1,14 +1,14 @@ --- -# Per environment values which override defaults in hmpps-template-typescript/values.yaml +# Per environment values which override defaults in hmpps-authorization/values.yaml generic-service: replicaCount: 2 ingress: - host: hmpps-template-typescript-dev.hmpps.service.justice.gov.uk + host: hmpps-authorization-dev.hmpps.service.justice.gov.uk env: - INGRESS_URL: "https://hmpps-template-typescript-dev.hmpps.service.justice.gov.uk" + INGRESS_URL: "https://hmpps-authorization-dev.hmpps.service.justice.gov.uk" HMPPS_AUTH_URL: "https://sign-in-dev.hmpps.service.justice.gov.uk/auth" TOKEN_VERIFICATION_API_URL: "https://token-verification-api-dev.prison.service.justice.gov.uk" diff --git a/helm_deploy/values-preprod.yaml b/helm_deploy/values-preprod.yaml index b527b8f3..61c0795f 100644 --- a/helm_deploy/values-preprod.yaml +++ b/helm_deploy/values-preprod.yaml @@ -1,14 +1,14 @@ --- -# Per environment values which override defaults in hmpps-template-typescript/values.yaml +# Per environment values which override defaults in hmpps-authorization/values.yaml generic-service: replicaCount: 2 ingress: - host: hmpps-template-typescript-preprod.hmpps.service.justice.gov.uk + host: hmpps-authorization-preprod.hmpps.service.justice.gov.uk env: - INGRESS_URL: "https://hmpps-template-typescript-preprod.hmpps.service.justice.gov.uk" + INGRESS_URL: "https://hmpps-authorization-preprod.hmpps.service.justice.gov.uk" HMPPS_AUTH_URL: "https://sign-in-preprod.hmpps.service.justice.gov.uk/auth" TOKEN_VERIFICATION_API_URL: "https://token-verification-api-preprod.prison.service.justice.gov.uk" diff --git a/helm_deploy/values-prod.yaml b/helm_deploy/values-prod.yaml index 815238de..dcbbc3c9 100644 --- a/helm_deploy/values-prod.yaml +++ b/helm_deploy/values-prod.yaml @@ -1,12 +1,12 @@ --- -# Per environment values which override defaults in hmpps-template-typescript/values.yaml +# Per environment values which override defaults in hmpps-authorization/values.yaml generic-service: ingress: - host: hmpps-template-typescript.hmpps.service.justice.gov.uk + host: hmpps-authorization.hmpps.service.justice.gov.uk env: - INGRESS_URL: "https://hmpps-template-typescript.hmpps.service.justice.gov.uk" + INGRESS_URL: "https://hmpps-authorization.hmpps.service.justice.gov.uk" HMPPS_AUTH_URL: "https://sign-in.hmpps.service.justice.gov.uk/auth" TOKEN_VERIFICATION_API_URL: "https://token-verification-api.prison.service.justice.gov.uk" diff --git a/logger.ts b/logger.ts index 85f0ff50..247c4725 100755 --- a/logger.ts +++ b/logger.ts @@ -4,6 +4,6 @@ import config from './server/config' const formatOut = bunyanFormat({ outputMode: 'short', color: !config.production }) -const logger = bunyan.createLogger({ name: 'HMPPS Typescript Template', stream: formatOut, level: 'debug' }) +const logger = bunyan.createLogger({ name: 'Hmpps Authorization', stream: formatOut, level: 'debug' }) export default logger diff --git a/package-lock.json b/package-lock.json index 60daa82e..a0c735b7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "hmpps-template-typescript", + "name": "hmpps-authorization", "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "hmpps-template-typescript", + "name": "hmpps-authorization", "version": "0.0.1", "license": "MIT", "dependencies": { diff --git a/package.json b/package.json index a863f223..9f8bad9a 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { - "name": "hmpps-template-typescript", + "name": "hmpps-authorization", "version": "0.0.1", - "description": "HMPPS Typescript Template", - "repository": "git@github.com:ministryofjustice/hmpps-template-typescript.git", + "description": "Hmpps Authorization", + "repository": "git@github.com:ministryofjustice/hmpps-authorization.git", "license": "MIT", "scripts": { "prepare": "husky install", diff --git a/rename-project.bash b/rename-project.bash deleted file mode 100755 index 59c557c7..00000000 --- a/rename-project.bash +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -set -e - -if ! echo "$BASH_VERSION" | grep -E "^[45]" &>/dev/null; then - echo "Found bash version: $BASH_VERSION" - echo "Ensure you are using bash version 4 or 5" - exit 1 -fi - -if [[ $# -ge 1 ]]; then - PROJECT_INPUT=$1 -else - read -rp "New project name e.g. prison-visits >" PROJECT_INPUT -fi - -PROJECT_NAME_LOWER=${PROJECT_INPUT,,} # lowercase -PROJECT_NAME_HYPHENS=${PROJECT_NAME_LOWER// /-} # spaces to hyphens - -PROJECT_NAME=${PROJECT_NAME_HYPHENS//[^a-z0-9-]/} # remove all other characters - -read -ra PROJECT_NAME_ARRAY <<<"${PROJECT_NAME//-/ }" # convert to array -PROJECT_DESCRIPTION=${PROJECT_NAME_ARRAY[*]^} # convert array back to string thus capitalising first character - -echo "Found: Project of $PROJECT_DESCRIPTION" -echo " Project name of $PROJECT_NAME" - -echo "Performing search and replace" - -# exclude files that get in the way and don't make any difference -EXCLUDES="( -path ./dist -o -path ./node_modules -o -path ./assets -o -path ./.git -o -path ./rename-project.bash )" -# shellcheck disable=SC2086 -find . $EXCLUDES -prune -o -type f -exec /usr/bin/sed -i.bak \ - -e "s/hmpps-template-typescript/$PROJECT_NAME/g" \ - -e "s/HMPPS Typescript Template/$PROJECT_DESCRIPTION/g" {} \; -exec rm '{}.bak' \; - -echo "Performing directory renames" - -# move helm stuff to new name -mv "helm_deploy/hmpps-template-typescript" "helm_deploy/$PROJECT_NAME" - -# change cron job to be random time otherwise we hit rate limiting with veracode -RANDOM_HOUR=$((RANDOM % (9 - 3 + 1) + 3)) -RANDOM_MINUTE=$(($RANDOM%60)) -RANDOM_MINUTE2=$(($RANDOM%60)) -sed -i -z -E \ - -e "s/security:\n triggers:\n - schedule:\n cron: \"30 5/security:\n triggers:\n - schedule:\n cron: \"$RANDOM_MINUTE $RANDOM_HOUR/" \ - -e "s/security-weekly:\n triggers:\n - schedule:\n cron: \"0 5/security-weekly:\n triggers:\n - schedule:\n cron: \"$RANDOM_MINUTE2 $RANDOM_HOUR/" \ - .circleci/config.yml - -# lastly remove ourselves -rm rename-project.bash - -echo "Completed." -echo "Please now review changes" diff --git a/server/utils/nunjucksSetup.ts b/server/utils/nunjucksSetup.ts index dfcf6704..b8bcd2d4 100644 --- a/server/utils/nunjucksSetup.ts +++ b/server/utils/nunjucksSetup.ts @@ -11,7 +11,7 @@ export default function nunjucksSetup(app: express.Express, applicationInfo: App app.set('view engine', 'njk') app.locals.asset_path = '/assets/' - app.locals.applicationName = 'HMPPS Typescript Template' + app.locals.applicationName = 'Hmpps Authorization' // Cachebusting version string if (production) {