diff --git a/admin/angular.json b/admin/angular.json index aec9bf4..c1ff30e 100644 --- a/admin/angular.json +++ b/admin/angular.json @@ -39,12 +39,24 @@ "maximumError": "8kB" } ], - "outputHashing": "all" + "outputHashing": "all", + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.production.ts" + } + ] }, "development": { "optimization": false, "extractLicenses": false, - "sourceMap": true + "sourceMap": true, + "fileReplacements": [ + { + "replace": "src/environments/environment.ts", + "with": "src/environments/environment.development.ts" + } + ] } }, "defaultConfiguration": "production" diff --git a/admin/src/app/services/configuration.service.ts b/admin/src/app/services/configuration.service.ts new file mode 100644 index 0000000..714df87 --- /dev/null +++ b/admin/src/app/services/configuration.service.ts @@ -0,0 +1,13 @@ +import { Injectable } from '@angular/core'; +import { environment } from '../../environments/environment'; + +@Injectable({ + providedIn: 'root', +}) +export class ConfigurationService { + + public getApiUrl(): string{ + return environment.apiUrl; + } + +} diff --git a/admin/src/app/services/configuration.spec.ts b/admin/src/app/services/configuration.spec.ts new file mode 100644 index 0000000..2d9042b --- /dev/null +++ b/admin/src/app/services/configuration.spec.ts @@ -0,0 +1,16 @@ +import { TestBed } from '@angular/core/testing'; + +import { ConfigurationService } from './configuration.service'; + +describe('Configuration', () => { + let service: ConfigurationService; + + beforeEach(() => { + TestBed.configureTestingModule({}); + service = TestBed.inject(ConfigurationService); + }); + + it('should be created', () => { + expect(service).toBeTruthy(); + }); +}); diff --git a/admin/src/environments/environment.development.ts b/admin/src/environments/environment.development.ts new file mode 100644 index 0000000..d0fd11c --- /dev/null +++ b/admin/src/environments/environment.development.ts @@ -0,0 +1,5 @@ +import { AppConfig } from '../types'; + +export const environment: AppConfig = { + apiUrl: 'http://localhost:4200/api' +}; diff --git a/admin/src/environments/environment.production.ts b/admin/src/environments/environment.production.ts new file mode 100644 index 0000000..d0fd11c --- /dev/null +++ b/admin/src/environments/environment.production.ts @@ -0,0 +1,5 @@ +import { AppConfig } from '../types'; + +export const environment: AppConfig = { + apiUrl: 'http://localhost:4200/api' +}; diff --git a/admin/src/environments/environment.ts b/admin/src/environments/environment.ts new file mode 100644 index 0000000..d0fd11c --- /dev/null +++ b/admin/src/environments/environment.ts @@ -0,0 +1,5 @@ +import { AppConfig } from '../types'; + +export const environment: AppConfig = { + apiUrl: 'http://localhost:4200/api' +}; diff --git a/admin/src/types.ts b/admin/src/types.ts new file mode 100644 index 0000000..8b94e90 --- /dev/null +++ b/admin/src/types.ts @@ -0,0 +1,4 @@ + +export interface AppConfig{ + apiUrl: string; +}