-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathapp.config.server.ts
More file actions
25 lines (22 loc) · 1006 Bytes
/
app.config.server.ts
File metadata and controls
25 lines (22 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import { mergeApplicationConfig, ApplicationConfig, inject, REQUEST_CONTEXT } from '@angular/core';
import { initializeServerApp, provideFirebaseApp } from '@angular/fire/app';
import { provideServerRendering } from '@angular/platform-server';
import { provideServerRouting } from '@angular/ssr';
import { appConfig } from './app.config';
import { serverRoutes } from './app.routes.server';
import { environment } from '../environments/environment';
const serverConfig: ApplicationConfig = {
providers: [
provideServerRendering(),
provideServerRouting(serverRoutes),
provideFirebaseApp(() => {
// TODO migrate to REQUEST once that's working
const requestContext = inject(REQUEST_CONTEXT, { optional: true }) as {
authIdToken: string,
} | undefined;
const authIdToken = requestContext?.authIdToken;
return initializeServerApp(environment.firebase, { authIdToken });
}),
]
};
export const config = mergeApplicationConfig(appConfig, serverConfig);