Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add flexibility to modify the base-href of DataDashboard app #247

Merged
merged 5 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading