Skip to content

Commit 92b128c

Browse files
committed
feat: update code from site15
1 parent 84c5616 commit 92b128c

File tree

78 files changed

+942
-544
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+942
-544
lines changed

.kubernetes/set-env.sh

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,7 @@ set -e
33

44
export REPOSITORY=nestjs-mod/nestjs-mod-sso
55
export REGISTRY=ghcr.io
6-
export BASE_SINGLE_SIGN_ON_IMAGE_NAME="${REPOSITORY}-base-server"
7-
export BUILDER_IMAGE_NAME="${REPOSITORY}-builder"
8-
export MIGRATIONS_IMAGE_NAME="${REPOSITORY}-migrations"
96
export SINGLE_SIGN_ON_IMAGE_NAME="${REPOSITORY}-server"
10-
export NGINX_IMAGE_NAME="${REPOSITORY}-nginx"
11-
export E2E_TESTS_IMAGE_NAME="${REPOSITORY}-e2e-tests"
127
export COMPOSE_INTERACTIVE_NO_CLI=1
138
export NX_DAEMON=false
149
export NX_PARALLEL=1
@@ -28,70 +23,88 @@ fi
2823

2924
# node
3025
if [ -z "${NAMESPACE}" ]; then
31-
export NAMESPACE=sso
26+
echo "Error: NAMESPACE not!" >&2 # Redirect error message to stderr
27+
exit 1 # Exit with an error code
3228
fi
3329

3430
# common
3531
if [ -z "${SINGLE_SIGN_ON_DOMAIN}" ]; then
36-
export SINGLE_SIGN_ON_DOMAIN=example.com
32+
echo "Error: SINGLE_SIGN_ON_DOMAIN not!" >&2 # Redirect error message to stderr
33+
exit 1 # Exit with an error code
3734
fi
3835

3936
# server
4037
if [ -z "${SINGLE_SIGN_ON_PORT}" ]; then
41-
export SINGLE_SIGN_ON_PORT=9191
38+
echo "Error: SINGLE_SIGN_ON_PORT not!" >&2 # Redirect error message to stderr
39+
exit 1 # Exit with an error code
4240
fi
4341

4442
# server: webhook database
4543
if [ -z "${SINGLE_SIGN_ON_WEBHOOK_DATABASE_PASSWORD}" ]; then
46-
export SINGLE_SIGN_ON_WEBHOOK_DATABASE_PASSWORD=webhook_password
44+
echo "Error: SINGLE_SIGN_ON_WEBHOOK_DATABASE_PASSWORD not!" >&2 # Redirect error message to stderr
45+
exit 1 # Exit with an error code
4746
fi
4847
if [ -z "${SINGLE_SIGN_ON_WEBHOOK_DATABASE_USERNAME}" ]; then
49-
export SINGLE_SIGN_ON_WEBHOOK_DATABASE_USERNAME=${NAMESPACE}_webhook
48+
echo "Error: SINGLE_SIGN_ON_WEBHOOK_DATABASE_USERNAME not!" >&2 # Redirect error message to stderr
49+
exit 1 # Exit with an error code
5050
fi
5151
if [ -z "${SINGLE_SIGN_ON_WEBHOOK_DATABASE_NAME}" ]; then
52-
export SINGLE_SIGN_ON_WEBHOOK_DATABASE_NAME=${NAMESPACE}_webhook
52+
echo "Error: SINGLE_SIGN_ON_WEBHOOK_DATABASE_NAME not!" >&2 # Redirect error message to stderr
53+
exit 1 # Exit with an error code
5354
fi
5455

5556
# server: sso database
5657
if [ -z "${SINGLE_SIGN_ON_SSO_DATABASE_PASSWORD}" ]; then
57-
export SINGLE_SIGN_ON_SSO_DATABASE_PASSWORD=sso_password
58+
echo "Error: SINGLE_SIGN_ON_SSO_DATABASE_PASSWORD not!" >&2 # Redirect error message to stderr
59+
exit 1 # Exit with an error code
5860
fi
5961
if [ -z "${SINGLE_SIGN_ON_SSO_DATABASE_USERNAME}" ]; then
60-
export SINGLE_SIGN_ON_SSO_DATABASE_USERNAME=${NAMESPACE}_sso
62+
echo "Error: SINGLE_SIGN_ON_SSO_DATABASE_USERNAME not!" >&2 # Redirect error message to stderr
63+
exit 1 # Exit with an error code
6164
fi
6265
if [ -z "${SINGLE_SIGN_ON_SSO_DATABASE_NAME}" ]; then
63-
export SINGLE_SIGN_ON_SSO_DATABASE_NAME=${NAMESPACE}_sso
66+
echo "Error: SINGLE_SIGN_ON_SSO_DATABASE_NAME not!" >&2 # Redirect error message to stderr
67+
exit 1 # Exit with an error code
6468
fi
6569

6670
# server: notifications database
6771
if [ -z "${SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_PASSWORD}" ]; then
68-
export SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_PASSWORD=notifications_password
72+
echo "Error: SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_PASSWORD not!" >&2 # Redirect error message to stderr
73+
exit 1 # Exit with an error code
6974
fi
7075
if [ -z "${SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_USERNAME}" ]; then
71-
export SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_USERNAME=${NAMESPACE}_notifications
76+
echo "Error: SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_USERNAME not!" >&2 # Redirect error message to stderr
77+
exit 1 # Exit with an error code
7278
fi
7379
if [ -z "${SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_NAME}" ]; then
74-
export SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_NAME=${NAMESPACE}_notifications
80+
echo "Error: SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_NAME not!" >&2 # Redirect error message to stderr
81+
exit 1 # Exit with an error code
7582
fi
7683

7784
# server: two factor database
7885
if [ -z "${SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_PASSWORD}" ]; then
79-
export SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_PASSWORD=two_factor_password
86+
echo "Error: SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_PASSWORD not!" >&2 # Redirect error message to stderr
87+
exit 1 # Exit with an error code
8088
fi
8189
if [ -z "${SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_USERNAME}" ]; then
82-
export SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_USERNAME=${NAMESPACE}_two_factor
90+
echo "Error: SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_USERNAME not!" >&2 # Redirect error message to stderr
91+
exit 1 # Exit with an error code
8392
fi
8493
if [ -z "${SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_NAME}" ]; then
85-
export SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_NAME=${NAMESPACE}_two_factor
94+
echo "Error: SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_NAME not!" >&2 # Redirect error message to stderr
95+
exit 1 # Exit with an error code
8696
fi
8797

8898
# database
8999
if [ -z "${SINGLE_SIGN_ON_POSTGRE_SQL_POSTGRESQL_USERNAME}" ]; then
90-
export SINGLE_SIGN_ON_POSTGRE_SQL_POSTGRESQL_USERNAME=postgres
100+
echo "Error: SINGLE_SIGN_ON_POSTGRE_SQL_POSTGRESQL_USERNAME not!" >&2 # Redirect error message to stderr
101+
exit 1 # Exit with an error code
91102
fi
92103
if [ -z "${SINGLE_SIGN_ON_POSTGRE_SQL_POSTGRESQL_PASSWORD}" ]; then
93-
export SINGLE_SIGN_ON_POSTGRE_SQL_POSTGRESQL_PASSWORD=postgres_password
104+
echo "Error: SINGLE_SIGN_ON_POSTGRE_SQL_POSTGRESQL_PASSWORD not!" >&2 # Redirect error message to stderr
105+
exit 1 # Exit with an error code
94106
fi
95107
if [ -z "${SINGLE_SIGN_ON_POSTGRE_SQL_POSTGRESQL_DATABASE}" ]; then
96-
export SINGLE_SIGN_ON_POSTGRE_SQL_POSTGRESQL_DATABASE=postgres
108+
echo "Error: SINGLE_SIGN_ON_POSTGRE_SQL_POSTGRESQL_DATABASE not!" >&2 # Redirect error message to stderr
109+
exit 1 # Exit with an error code
97110
fi

.kubernetes/templates/docker-compose-infra.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ services:
2727
- 'nestjs-mod-sso-postgre-sql-volume:/bitnami/postgresql'
2828
volumes:
2929
nestjs-mod-sso-postgre-sql-volume:
30-
external: true
3130
name: 'nestjs-mod-sso-postgre-sql-volume'

.kubernetes/templates/node/8.issuer.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ metadata:
55
namespace: cert-manager
66
spec:
77
acme:
8-
8+
email: %SINGLE_SIGN_ON_SSO_ADMIN_EMAIL%
99
server: https://acme-v02.api.letsencrypt.org/directory
1010
privateKeySecretRef:
1111
name: letsencrypt-prod

.kubernetes/templates/server/1.configmap.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ data:
1111
SINGLE_SIGN_ON_SSO_DATABASE_URL: 'postgres://%SINGLE_SIGN_ON_SSO_DATABASE_USERNAME%:%SINGLE_SIGN_ON_SSO_DATABASE_PASSWORD%@10.0.1.1:5432/%SINGLE_SIGN_ON_SSO_DATABASE_NAME%?schema=public'
1212
SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_URL: 'postgres://%SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_USERNAME%:%SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_PASSWORD%@10.0.1.1:5432/%SINGLE_SIGN_ON_NOTIFICATIONS_DATABASE_NAME%?schema=public'
1313
SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_URL: 'postgres://%SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_USERNAME%:%SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_PASSWORD%@10.0.1.1:5432/%SINGLE_SIGN_ON_TWO_FACTOR_DATABASE_NAME%?schema=public'
14-
SINGLE_SIGN_ON_SSO_ADMIN_EMAIL: '[email protected]'
15-
SINGLE_SIGN_ON_SSO_ADMIN_USERNAME: 'admin'
14+
SINGLE_SIGN_ON_SSO_ADMIN_EMAIL: '%SINGLE_SIGN_ON_SSO_ADMIN_EMAIL%'
15+
SINGLE_SIGN_ON_SSO_ADMIN_USERNAME: '%SINGLE_SIGN_ON_SSO_ADMIN_USERNAME%'
1616
SINGLE_SIGN_ON_SSO_ADMIN_PASSWORD: '%SINGLE_SIGN_ON_SSO_ADMIN_PASSWORD%'
1717
SINGLE_SIGN_ON_SSO_ADMIN_SECRET: '%SINGLE_SIGN_ON_SSO_ADMIN_SECRET%'
1818
SINGLE_SIGN_ON_MINIO_SERVER_HOST: '%NAMESPACE%-minio.%NAMESPACE%'
@@ -24,5 +24,8 @@ data:
2424
SINGLE_SIGN_ON_SSO_SERVER_URL: 'https://%SINGLE_SIGN_ON_DOMAIN%'
2525
SINGLE_SIGN_ON_SSO_GOOGLE_OAUTH_CLIENT_ID: '%SINGLE_SIGN_ON_SSO_GOOGLE_OAUTH_CLIENT_ID%'
2626
SINGLE_SIGN_ON_SSO_GOOGLE_OAUTH_CLIENT_SECRET_KEY: '%SINGLE_SIGN_ON_SSO_GOOGLE_OAUTH_CLIENT_SECRET_KEY%'
27-
SINGLE_SIGN_ON_SSO_DEFAULT_PUBLIC_TENANTS: 'Beijing:ru=Пекин,Jq6GQ6Rzz6x8HNOD4x2Hc2eM0cfiCVUzGfsi,X6nk0OZXQJboSEfugnH35e9oSeg5RFlV0DQprtYyYDQjNli9mA;Moscow:ru=Москва,OceX08HGZ89PTkPpg9KDk5ErY1uMfDcfFKkw,VJztpDIwvqG6IkTVEIDEw1Ed2Wu5oHu6zfBe7CCJFrCtyWO2Yv;New York:ru=Нью-Йорк,4OGD25Rmn3W3MP0kMd7c90rGP1WwK8u4wL1w,qm8nc9MgKyvd6Hgl3jY5BjgDFSBqNvxcu6o52kDjIC168OsM1R;'
28-
SINGLE_SIGN_ON_SSO_DEFAULT_TENANT: 'default:ru=по умолчанию,KzMRNEZTetzatIgQPVSDYfeGyaZrbLzkcxNc,qaHkVpAtUVIpDdLXMlAOzsBfMRJblWoHpXguYQRBuSEBpGKbWt'
27+
SINGLE_SIGN_ON_SSO_DEFAULT_PUBLIC_TENANTS: '%SINGLE_SIGN_ON_SSO_DEFAULT_PUBLIC_TENANTS%'
28+
SINGLE_SIGN_ON_SSO_DEFAULT_TENANT: '%SINGLE_SIGN_ON_SSO_DEFAULT_TENANT%'
29+
SINGLE_SIGN_ON_NOTIFICATIONS_MAIL_TRANSPORT: '%SINGLE_SIGN_ON_NOTIFICATIONS_MAIL_TRANSPORT%'
30+
SINGLE_SIGN_ON_NOTIFICATIONS_MAIL_DEFAULT_SENDER_NAME: '%SINGLE_SIGN_ON_NOTIFICATIONS_MAIL_DEFAULT_SENDER_NAME%'
31+
SINGLE_SIGN_ON_NOTIFICATIONS_MAIL_DEFAULT_SENDER_EMAIL: '%SINGLE_SIGN_ON_NOTIFICATIONS_MAIL_DEFAULT_SENDER_EMAIL%'

app-swagger.json

Lines changed: 0 additions & 1 deletion
This file was deleted.

apps/client-e2e/playwright.config.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { nxE2EPreset } from '@nx/playwright/preset';
22
import { defineConfig, devices } from '@playwright/test';
3-
import { execSync } from 'child_process';
43
import { config } from 'dotenv';
54
import { existsSync } from 'fs';
65
import { join } from 'path';
@@ -34,9 +33,9 @@ export default defineConfig({
3433
/* Run tests in files in parallel */
3534
fullyParallel: false,
3635
workers: 1,
37-
maxFailures: 10,
38-
retries: 3,
39-
timeout: 120 * 1000,
36+
maxFailures: 4,
37+
retries: 2,
38+
timeout: 30 * 1000,
4039
reporter: [['list']],
4140
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
4241
use: {

apps/client-e2e/src/profile-as-user.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ test.describe('Work with profile as "User" role', () => {
1414
password: faker.internet.password({ length: 8 }),
1515
site: `http://${faker.internet.domainName()}`,
1616
};
17+
1718
let page: Page;
1819

1920
test.beforeAll(async ({ browser }) => {
@@ -34,6 +35,10 @@ test.describe('Work with profile as "User" role', () => {
3435
(minioURL) => localStorage.setItem('minioURL', minioURL),
3536
get('SINGLE_SIGN_ON_MINIO_URL').required().asString(),
3637
);
38+
await page.evaluate(
39+
(code) => localStorage.setItem('x-skip-email-verification', code),
40+
get('SINGLE_SIGN_ON_SSO_ADMIN_SECRET').required().asString(),
41+
);
3742
});
3843

3944
test.afterAll(async () => {

apps/client-e2e/src/ru-validation-with-store-lang-in-db.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ test.describe('Validation with store lang in db (ru)', () => {
1414
password: faker.internet.password({ length: 8 }),
1515
site: `http://${faker.internet.domainName()}`,
1616
};
17+
1718
let page: Page;
1819

1920
test.beforeAll(async ({ browser }) => {
@@ -34,6 +35,10 @@ test.describe('Validation with store lang in db (ru)', () => {
3435
(minioURL) => localStorage.setItem('minioURL', minioURL),
3536
get('SINGLE_SIGN_ON_MINIO_URL').required().asString(),
3637
);
38+
await page.evaluate(
39+
(code) => localStorage.setItem('x-skip-email-verification', code),
40+
get('SINGLE_SIGN_ON_SSO_ADMIN_SECRET').required().asString(),
41+
);
3742
});
3843

3944
test.afterAll(async () => {

apps/client-e2e/src/ru-validation.spec.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@ test.describe('Validation (ru)', () => {
3434
(minioURL) => localStorage.setItem('minioURL', minioURL),
3535
get('SINGLE_SIGN_ON_MINIO_URL').required().asString(),
3636
);
37+
await page.evaluate(
38+
(code) => localStorage.setItem('x-skip-email-verification', code),
39+
get('SINGLE_SIGN_ON_SSO_ADMIN_SECRET').required().asString(),
40+
);
3741
});
3842

3943
test.afterAll(async () => {

apps/client-e2e/src/timezone-profile-as-user.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ test.describe('Work with profile as "User" role (timezone', () => {
1616
password: faker.internet.password({ length: 8 }),
1717
site: `http://${faker.internet.domainName()}`,
1818
};
19+
1920
let page: Page;
2021

2122
test.beforeAll(async ({ browser }) => {
@@ -36,6 +37,10 @@ test.describe('Work with profile as "User" role (timezone', () => {
3637
(minioURL) => localStorage.setItem('minioURL', minioURL),
3738
get('SINGLE_SIGN_ON_MINIO_URL').required().asString(),
3839
);
40+
await page.evaluate(
41+
(code) => localStorage.setItem('x-skip-email-verification', code),
42+
get('SINGLE_SIGN_ON_SSO_ADMIN_SECRET').required().asString(),
43+
);
3944
});
4045

4146
test.afterAll(async () => {

0 commit comments

Comments
 (0)