Skip to content

Commit

Permalink
feat: Add flexibility to modify the base-href of DataDashboard app (#247
Browse files Browse the repository at this point in the history
)

* Update Dockerfile and app-config.service.ts to work with helm

* Update Dockerfile and app-config.service.ts to work with helm

* Update build command in Dockerfile

* Update build command in Dockerfile

* Update Dockerfile - add default base path
  • Loading branch information
farhin23 authored May 8, 2024
1 parent 5645d9f commit d11470c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Stage 1: Compile and Build angular codebase
FROM node:lts as build

ARG BASE_PATH=/

WORKDIR /app
COPY ./ /app/
RUN npm install
RUN npm run build
RUN npm run build -- --base-href=$BASE_PATH

# Stage 2: Serve app with nginx
FROM nginx:alpine
Expand Down
7 changes: 5 additions & 2 deletions src/modules/app/app-config.service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {HttpClient} from '@angular/common/http';
import {Injectable} from '@angular/core';
import { LocationStrategy } from '@angular/common';

export interface AppConfig {
managementApiUrl: string;
Expand All @@ -15,11 +16,13 @@ export interface AppConfig {
export class AppConfigService {
config?: AppConfig;

constructor(private http: HttpClient) {}
constructor(private http: HttpClient, private locationStrategy: LocationStrategy) {}

loadConfig(): Promise<void> {
let appConfigUrl = this.locationStrategy.prepareExternalUrl('assets/config/app.config.json');

return this.http
.get<AppConfig>('/assets/config/app.config.json')
.get<AppConfig>(appConfigUrl)
.toPromise()
.then(data => {
this.config = data;
Expand Down

0 comments on commit d11470c

Please sign in to comment.