From d063d307bcbaa5cfd351add508d3a2c8392288d7 Mon Sep 17 00:00:00 2001
From: AndiMajore <andi.majore@googlemail.com>
Date: Mon, 7 Jun 2021 14:48:23 +0200
Subject: [PATCH] created dev environment for local backend execution

---
 angular.json                        | 14 +++++++++++++-
 package.json                        |  2 +-
 src/environments/environment.dev.ts | 17 +++++++++++++++++
 src/environments/environment.ts     |  3 +--
 4 files changed, 32 insertions(+), 4 deletions(-)
 create mode 100644 src/environments/environment.dev.ts

diff --git a/angular.json b/angular.json
index c2620600..198d87f4 100644
--- a/angular.json
+++ b/angular.json
@@ -34,6 +34,14 @@
             "crossOrigin": "use-credentials"
           },
           "configurations": {
+            "dev": {
+              "fileReplacements": [
+                {
+                  "replace": "src/environments/environment.ts",
+                  "with": "src/environments/environment.dev.ts"
+                }
+              ]
+            },
             "production": {
               "fileReplacements": [
                 {
@@ -67,9 +75,13 @@
         "serve": {
           "builder": "@angular-devkit/build-angular:dev-server",
           "options": {
-            "browserTarget": "netex:build"
+            "browserTarget": "netex:build",
+            "proxyConfig": "conf/proxy.conf.json"
           },
           "configurations": {
+            "dev": {
+              "browserTarget": "netex:build:dev"
+            },
             "production": {
               "browserTarget": "netex:build:production"
             }
diff --git a/package.json b/package.json
index 20efa1e0..fac8b6a5 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
   "version": "0.0.0",
   "scripts": {
     "ng": "ng",
-    "start": "ng serve",
+    "start": "ng serve --configuration=dev",
     "build": "ng build",
     "test": "ng test",
     "lint": "ng lint && htmlhint",
diff --git a/src/environments/environment.dev.ts b/src/environments/environment.dev.ts
new file mode 100644
index 00000000..e999dedb
--- /dev/null
+++ b/src/environments/environment.dev.ts
@@ -0,0 +1,17 @@
+// This file can be replaced during build by using the `fileReplacements` array.
+// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
+// The list of file replacements can be found in `angular.json`.
+
+export const environment = {
+  production: false,
+  backend: 'http://localhost:8001/'
+};
+
+/*
+ * For easier debugging in development mode, you can import the following file
+ * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
+ *
+ * This import should be commented out in production mode because it will have a negative impact
+ * on performance if an error is thrown.
+ */
+import 'zone.js/dist/zone-error';  // Included with Angular CLI.
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index d2aa767e..d6079ecd 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -4,8 +4,7 @@
 
 export const environment = {
   production: false,
-  // backend: 'http://10.162.163.20:8001/',
-  backend: 'http://localhost:8001/'
+  backend: 'http://10.162.163.20:8001/',
 };
 
 /*
-- 
GitLab