Skip to content

Commit

Permalink
fix env
Browse files Browse the repository at this point in the history
  • Loading branch information
FelixTJDietrich committed Aug 13, 2024
1 parent b224d20 commit 80c79ce
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
1 change: 1 addition & 0 deletions webapp/.env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
NG_APPLICATION_SERVER_URL=http://localhost:8080
16 changes: 7 additions & 9 deletions webapp/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,11 @@
"styles": [
"src/styles.css"
],
"scripts": []
"scripts": [],
"ngxEnv": {
"prefix": "NG_",
"root": "../../"
}
},
"configurations": {
"production": {
Expand All @@ -77,13 +81,7 @@
"development": {
"optimization": false,
"extractLicenses": false,
"sourceMap": true,
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.development.ts"
}
]
"sourceMap": true
}
},
"defaultConfiguration": "production"
Expand Down Expand Up @@ -148,4 +146,4 @@
}
}
}
}
}
3 changes: 1 addition & 2 deletions webapp/src/app/app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { provideAnimationsAsync } from '@angular/platform-browser/animations/asy
import { provideHttpClient, withInterceptorsFromDi } from '@angular/common/http';
import { provideAngularQuery, QueryClient } from '@tanstack/angular-query-experimental';
import { LucideAngularModule, Home, Sun, Moon, Hammer } from 'lucide-angular';
import { APPLICATION_SERVER_URL } from 'environments/environment';
import { BASE_PATH } from 'app/core/modules/openapi';
import { routes } from 'app/app.routes';

Expand All @@ -16,6 +15,6 @@ export const appConfig: ApplicationConfig = {
provideHttpClient(withInterceptorsFromDi()),
provideAnimationsAsync(),
importProvidersFrom(LucideAngularModule.pick({ Home, Sun, Moon, Hammer })),
{ provide: BASE_PATH, useValue: APPLICATION_SERVER_URL }
{ provide: BASE_PATH, useValue: import.meta.env.NG_APPLICATION_SERVER_URL }
]
};
12 changes: 5 additions & 7 deletions webapp/src/env.d.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Define the type of the environment variables.
declare interface Env {
readonly NODE_ENV: string;
readonly APPLICATION_SERVER_URL: string;
interface ImportMeta {
readonly env: ImportMetaEnv;
}

// Use import.meta.env.YOUR_ENV_VAR in your code.
declare interface ImportMeta {
readonly env: Env;
interface ImportMetaEnv {
readonly NODE_ENV: string;
readonly NG_APPLICATION_SERVER_URL: string;
}
1 change: 0 additions & 1 deletion webapp/src/environments/environment.development.ts

This file was deleted.

2 changes: 0 additions & 2 deletions webapp/src/environments/environment.ts

This file was deleted.

0 comments on commit 80c79ce

Please sign in to comment.