Skip to content

Commit d13df32

Browse files
committed
Review pipeline
1 parent 465be12 commit d13df32

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

.github/workflows/ci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,17 @@ jobs:
4040
#- name: Lint API
4141
# run: npm run lint
4242

43+
- name: Create .env file
44+
run: |
45+
echo "MACHINE_ID=1" > .env
46+
working-directory: api # Ensure it is created inside `api/`
47+
4348
- name: Run Tests (API)
4449
run: yarn test
4550

51+
- name: Build API
52+
run: yarn build
53+
4654
# Webapp (Next.js) Build & Test
4755
webapp:
4856
name: Webapp Build & Test

api/src/shorten-url/shorten-url.id-generator.service.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ export class ShortenUrlIdGeneratorService {
2828
private lastTimestamp: number;
2929

3030
constructor(private readonly configService: ConfigService) {
31+
// check if the machine id is not null
32+
if (!this.configService.get<number>('MACHINE_ID'))
33+
throw new Error('MACHINE_ID is not defined in the environment variables');
34+
3135
this.machineId = Number(this.configService.get<number>('MACHINE_ID'));
3236
if (
3337
this.machineId < 0 ||

0 commit comments

Comments
 (0)