Skip to content

Commit a6a9d14

Browse files
committed
configure base herf with env vairables
1 parent 644701d commit a6a9d14

File tree

10 files changed

+28
-12
lines changed

10 files changed

+28
-12
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
"start:render": "ng serve --configuration render",
1515
"start:pages": "ng serve --configuration pages",
1616
"start:nas": "ng serve --configuration nas",
17-
"start:mock": "node server.js",
17+
"start:server": "node server.js",
1818
"build": "ng build --configuration production",
1919
"build:azure": "ng build --configuration azure",
2020
"build:netlify": "ng build --configuration netlify",
2121
"build:render": "ng build --configuration render",
22-
"build:pages": "ng build --configuration pages --base-href /text-compare-angular/ --deploy-url /text-compare-angular/",
22+
"build:pages": "ng build --configuration pages",
2323
"build:nas": "ng build --configuration nas",
2424
"build:cross:env": "rimraf dist compiled && cross-env SOURCE_MAP=0 ng build --configuration production",
2525
"test": "ng test",

src/app/app.module.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { BrowserModule } from '@angular/platform-browser';
22
import { NgModule } from '@angular/core';
3+
import { APP_BASE_HREF } from '@angular/common';
34

45
import { AppComponent } from './app.component';
56
import { HomeComponent } from './home/home.component';
@@ -12,6 +13,7 @@ import { MonacoEditorModule } from 'ngx-monaco-editor-v2';
1213

1314
// routes
1415
import { AppRoutingModule } from './app-routing.module';
16+
import { environment } from '../environments/environment';
1517

1618
@NgModule({
1719
declarations: [
@@ -26,10 +28,10 @@ import { AppRoutingModule } from './app-routing.module';
2628
FormsModule,
2729
AppRoutingModule,
2830
MonacoEditorModule.forRoot({
29-
baseUrl: '/text-compare-angular/assets/monaco/min/vs'
31+
baseUrl: environment.monacoBaseUrl
3032
})
3133
],
32-
providers: [],
34+
providers: [{ provide: APP_BASE_HREF, useValue: environment.baseHref }],
3335
bootstrap: [AppComponent]
3436
})
3537
export class AppModule {}

src/app/header/header.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ export class HeaderComponent implements OnInit {
1414
protected router = inject(Router);
1515

1616
ngOnInit() {
17-
this.envName = environment.env_name;
17+
this.envName = environment.envName;
1818
}
1919
}
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export const environment = {
22
production: true,
3-
env_name: 'Azure'
3+
envName: 'Azure',
4+
baseHref: '/',
5+
monacoBaseUrl: '/assets/monaco/min/vs'
46
};
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export const environment = {
22
production: true,
3-
env_name: 'Nas'
3+
envName: 'Nas',
4+
baseHref: '/',
5+
monacoBaseUrl: '/assets/monaco/min/vs'
46
};
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export const environment = {
22
production: true,
3-
env_name: 'Netlify'
3+
envName: 'Netlify',
4+
baseHref: '/',
5+
monacoBaseUrl: '/assets/monaco/min/vs'
46
};
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export const environment = {
22
production: true,
3-
env_name: 'GitHub Pages'
3+
envName: 'GitHub Pages',
4+
baseHref: '/text-compare-angular/',
5+
monacoBaseUrl: '/assets/monaco/min/vs'
46
};
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export const environment = {
22
production: true,
3-
env_name: 'Production'
3+
envName: 'Production',
4+
baseHref: '/',
5+
monacoBaseUrl: '/assets/monaco/min/vs'
46
};
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
export const environment = {
22
production: true,
3-
env_name: 'Render'
3+
envName: 'Render',
4+
baseHref: '/',
5+
monacoBaseUrl: '/assets/monaco/min/vs'
46
};

src/environments/environment.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@
55

66
export const environment = {
77
production: false,
8-
env_name: 'Local'
8+
envName: 'Local',
9+
baseHref: '/',
10+
monacoBaseUrl: '/assets/monaco/min/vs'
911
};

0 commit comments

Comments
 (0)