Skip to content

Commit b841c9e

Browse files
committed
setup standalone environment
1 parent 621bcb2 commit b841c9e

File tree

4 files changed

+50
-3
lines changed

4 files changed

+50
-3
lines changed

angular.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,14 @@
107107
},
108108
"es5": {
109109
"tsConfig": "tsconfig.app.es5.json"
110+
},
111+
"standalone": {
112+
"fileReplacements": [
113+
{
114+
"replace": "src/environments/environment.ts",
115+
"with": "src/environments/environment.standalone.ts"
116+
}
117+
]
110118
}
111119
},
112120
"defaultConfiguration": ""
@@ -125,6 +133,9 @@
125133
},
126134
"es5": {
127135
"buildTarget": "netzgrafik-frontend:build:es5"
136+
},
137+
"standalone": {
138+
"buildTarget": "netzgrafik-frontend:build:standalone"
128139
}
129140
}
130141
},

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
"ng": "ng",
44
"start": "ng serve",
55
"start:local": "ng serve --configuration=local",
6+
"start:standalone": "ng serve --configuration=standalone",
67
"e2e:browserstack": "ng e2e -c browserstack",
78
"e2e:puppeteer": "ng e2e -c puppeteer",
89
"build": "ng run netzgrafik-frontend:ngsscbuild",
10+
"build:standalone": "ng build --configuration=standalone",
911
"test": "ng test -c ci",
1012
"lint": "ng lint",
1113
"e2e": "ng e2e",
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import {AuthConfig} from "angular-oauth2-oidc";
2+
import {Environment} from "./environment.model";
3+
4+
// This file can be replaced during build by using the `fileReplacements` array.
5+
// `ng build --prod` replaces `environment.ts` with `environment.prod.ts`.
6+
// The list of file replacements can be found in `angular.json`.
7+
8+
const authConfig: AuthConfig = {
9+
issuer: "http://localhost:8081/realms/netzgrafikeditor",
10+
// The ClientId you received from the IAM Team
11+
clientId: "netzgrafikeditor",
12+
// For production with Angular i18n the language code needs to be included in the redirectUri.
13+
// In your environment.prod.ts (or similar, but not your environment.ts) replace it with the following line:
14+
// redirectUri: location.origin + location.pathname.substring(0, location.pathname.indexOf('/', 1) + 1)
15+
// Note that these URIs must also be added to allowed redirect URIs in Azure (e.g. https://your-domain/en/, https://your-domain/de/, ...)
16+
redirectUri: location.origin,
17+
responseType: "code",
18+
scope: "openid profile email offline_access",
19+
};
20+
21+
export const environment: Environment = {
22+
production: false,
23+
label: "standalone",
24+
backendUrl: "http://localhost:8080",
25+
authConfig,
26+
disableBackend: true,
27+
customElement: true,
28+
};
29+
30+
/*
31+
* For easier debugging in development mode, you can import the following file
32+
* to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
33+
*
34+
* This import should be commented out in production mode because it will have a negative impact
35+
* on performance if an error is thrown.
36+
*/
37+
// import 'zone.js/plugins/zone-error'; // Included with Angular CLI.

src/main.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,6 @@ if (environment.production) {
77
enableProdMode();
88
}
99

10-
environment.disableBackend = true;
11-
environment.customElement = true;
12-
1310
platformBrowserDynamic()
1411
.bootstrapModule(AppModule)
1512
.catch((err) => console.error(err));

0 commit comments

Comments
 (0)