Skip to content

Commit

Permalink
CCM-5680 initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
timireland committed Aug 2, 2024
1 parent 0342e4c commit e013295
Show file tree
Hide file tree
Showing 6 changed files with 101 additions and 0 deletions.
20 changes: 20 additions & 0 deletions amplify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
version: 1
backend:
phases:
build:
commands:
- npm ci --cache .npm --prefer-offline
- npx ampx pipeline-deploy --branch $AWS_BRANCH --app-id $AWS_APP_ID
frontend:
phases:
build:
commands:
- npm run build
artifacts:
baseDirectory: .next
files:
- '**/*'
cache:
paths:
- .next/cache/**/*
- .npm/**/*
52 changes: 52 additions & 0 deletions amplify/auth/resource.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import { DeepPartialAmplifyGeneratedConfigs } from '@aws-amplify/plugin-types';
import { ClientConfig } from '@aws-amplify/client-config';

const userPoolId = process.env.USER_POOL_ID!;
const userPoolClientId = process.env.USER_POOL_CLIENT_ID!;
const hostedLoginDomain = process.env.HOSTED_LOGIN_DOMAIN!;

const appId = process.env.AWS_APP_ID!;
const group = process.env.NOTIFY_GROUP!;
const subdomain = process.env.NOTIFY_SUBDOMAIN!;
const domainName = process.env.NOTIFY_DOMAIN_NAME!;

export const authConfig: DeepPartialAmplifyGeneratedConfigs<ClientConfig> = {
auth: {
aws_region: 'eu-west-2',
user_pool_id: userPoolId,
user_pool_client_id: userPoolClientId,
oauth: {
'identity_providers': [],
'domain': hostedLoginDomain,
'scopes': [
'openid',
'email',
'profile',
'phone',
'aws.cognito.signin.user.admin'
],
'redirect_sign_in_uri': [
`https://${subdomain}.${appId}.amplifyapp.com/auth/`,
`https://${subdomain}.${domainName}/auth/`,
...(group === 'nonprod' ? ['http://localhost:3000/auth/']: [])
],
'redirect_sign_out_uri': [
`https://${subdomain}.${appId}.amplifyapp.com/`,
`https://${subdomain}.${domainName}/`,
...(group === 'nonprod' ? ['http://localhost:3000/']: [])
],
'response_type': 'code'
},
username_attributes: ['email'],
standard_required_attributes: ['email'],
user_verification_types: ['email'],
unauthenticated_identities_enabled: false,
password_policy: {
min_length: 8,
require_lowercase: true,
require_uppercase: true,
require_numbers: true,
require_symbols: true,
}
}
};
5 changes: 5 additions & 0 deletions amplify/backend.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { defineBackend } from '@aws-amplify/backend';
import { authConfig } from './auth/resource';

const backend = defineBackend({});
backend.addOutput(authConfig);
3 changes: 3 additions & 0 deletions amplify/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"type": "module"
}
17 changes: 17 additions & 0 deletions amplify/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"compilerOptions": {
"target": "es2022",
"module": "es2022",
"moduleResolution": "bundler",
"resolveJsonModule": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"strict": true,
"skipLibCheck": true,
"paths": {
"$amplify/*": [
"../.amplify/generated/*"
]
}
}
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,17 @@
"app:stop": "pm2 kill"
},
"dependencies": {
"@aws-amplify/backend": "^1.0.3",
"@aws-amplify/backend-cli": "^1.0.4",
"next": "14.2.5",
"nhsuk-frontend": "^8.3.0",
"nhsuk-react-components": "^4.1.0",
"react": "^18",
"react-dom": "^18"
},
"devDependencies": {
"@aws-amplify/adapter-nextjs": "^1.2.4",
"@aws-amplify/ui-react": "^6.1.12",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
Expand Down

0 comments on commit e013295

Please sign in to comment.