Skip to content

Commit 9c754f9

Browse files
Setup dynamic environment variable for backend API
1 parent cac2fb0 commit 9c754f9

4 files changed

Lines changed: 4 additions & 2 deletions

File tree

.github/workflows/pipeline.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ on:
77
branches: [main, develop]
88

99
env:
10+
NG_APP_BACKEND_API_URL: ${{ secrets.BACKEND_API_URL }}
1011
NG_APP_SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
1112
NG_APP_SUPABASE_ANON_KEY: ${{ secrets.SUPABASE_ANON_KEY }}
1213

src/_environments/environment.prod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { IEnvironment } from '@core/_models/environment/environment.interface';
33
export const ENVIRONMENT: IEnvironment = {
44
production: true,
55
useMocks: false,
6-
apiUrl: 'https://api.your-domain.com/api',
6+
apiUrl: process.env['NG_APP_BACKEND_API_URL'] || 'http://localhost:8000/api',
77
logLevel: 'error',
88
application: {
99
name: 'AngularTemplate',

src/_environments/environment.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { IEnvironment } from '@core/_models/environment/environment.interface';
33
export const ENVIRONMENT: IEnvironment = {
44
production: false,
55
useMocks: true,
6-
apiUrl: 'http://localhost:3000/api',
6+
apiUrl: process.env['NG_APP_BACKEND_API_URL'] || 'http://localhost:8000/api',
77
logLevel: 'debug',
88
mockAdminPassword: '1234',
99
application: {

src/env.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// eslint-disable-next-line @typescript-eslint/naming-convention
22
declare const process: {
33
env: {
4+
NG_APP_BACKEND_API_URL: string;
45
NG_APP_SUPABASE_URL: string;
56
NG_APP_SUPABASE_ANON_KEY: string;
67
[key: string]: string | undefined;

0 commit comments

Comments
 (0)