Skip to content

Commit 9c7993e

Browse files
committed
config docker
1 parent ff82bae commit 9c7993e

File tree

5 files changed

+25
-11
lines changed

5 files changed

+25
-11
lines changed

angular.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@
3333
},
3434
"configurations": {
3535
"production": {
36+
"fileReplacements": [
37+
{
38+
"replace": "src/environments/environment.ts",
39+
"with": "src/environments/environment.prod.ts"
40+
}
41+
],
3642
"budgets": [
3743
{
3844
"type": "initial",

proxy.conf.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"/api": {
3+
"target": "https://localhost:8888",
4+
"secure": false,
5+
"changeOrigin": true,
6+
"logLevel": "debug"
7+
}
8+
}

public/config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{ "apiUrl": "http://localhost:8888/api" }

src/app/core/services/config-service/api.enpoints.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ import {
99
import { SearchingUser } from '../../models/user.models';
1010

1111
export const version = '/v1';
12-
const runtimeConfig = (window as any).APP_CONFIG;
1312

1413
export const API_CONFIG = {
1514
BASE_URLS: {
16-
MAIN_API: runtimeConfig.IP_SERVER + version,
15+
MAIN_API: environment.IP_SERVER + version,
1716
SECONDARY_API: '',
1817
},
1918
ENDPOINTS: {

src/main.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { bootstrapApplication } from '@angular/platform-browser';
22
import { appConfig } from './app/app.config';
33
import { App } from './app/app';
44

5-
// Load runtime config trước khi bootstrap
6-
fetch('/assets/config.json')
7-
.then((response) => response.json())
8-
.then((config) => {
9-
(window as any).env = config;
10-
return bootstrapApplication(App, appConfig);
11-
})
12-
.catch((err) => console.error(err));
5+
// // Load runtime config trước khi bootstrap
6+
// fetch('/assets/config.json')
7+
// .then((response) => response.json())
8+
// .then((config) => {
9+
// (window as any).env = config;
10+
// return bootstrapApplication(App, appConfig);
11+
// })
12+
// .catch((err) => console.error(err));
1313

14-
// bootstrapApplication(App, appConfig).catch((err) => console.error(err));
14+
bootstrapApplication(App, appConfig).catch((err) => console.error(err));

0 commit comments

Comments
 (0)