Skip to content

Commit 5a1b73b

Browse files
committed
Update for bootstrapping
1 parent 3b09b11 commit 5a1b73b

File tree

4 files changed

+37
-15
lines changed

4 files changed

+37
-15
lines changed

client/web/angular-customer-app/src/app/app.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ export const appConfig: ApplicationConfig = {
3737
provideHttpClient( withFetch() ),
3838
provideMarkdown(),
3939
provideAnimationsAsync(),
40-
provideFirebaseApp(() => initializeApp(environment.firebaseConfig)),
40+
provideFirebaseApp(() => initializeApp(environment)),
4141
provideStorage(() => getStorage()),
4242
provideAuth(() => getAuth()),
4343
provideVertexAI(() => getVertexAI()),

client/web/angular-customer-app/src/app/app.routes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const routes: Routes = [
2222
path: 'chat',
2323
component: ChatbotComponent,
2424
},
25-
{ path: '/config.html', redirectTo: '/config.html'},
26-
{ path: '/config', redirectTo: '/config.html'},
25+
// { path: '/config.html', redirectTo: '/config.html'},
26+
// { path: '/config', redirectTo: '/config.html'},
2727
{ path: '**', redirectTo: '/chat' },
2828
];

client/web/angular-customer-app/src/environments/environment.development.ts

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,19 +14,40 @@
1414
* limitations under the License.
1515
*/
1616

17+
declare const window: any;
18+
19+
export declare interface BootstrapData {
20+
firebase: {
21+
apiKey?: string;
22+
authDomain?: string,
23+
databaseURL?: string,
24+
projectId?: string,
25+
storageBucket?: string,
26+
messagingSenderId?: string,
27+
measurementId?: string,
28+
appId?: string,
29+
};
30+
geminiApiKey?: string;
31+
debugToken?: string;
32+
viewCodeLink?: string;
33+
viewCodeMessage?: string;
34+
}
35+
36+
const bootstrapData = window['APP_TEMPLATE_BOOTSTRAP'] as BootstrapData;
37+
38+
console.log(bootstrapData);
39+
40+
if (!bootstrapData) {
41+
window.location.href = '/config.html';
42+
}
43+
1744
export const environment = {
18-
production: false,
19-
// URL for the backend. Exposed through the Angular proxy server.
20-
backendUrl: "/api",
21-
firebaseConfig: {
22-
apiKey: "",
23-
authDomain: "",
24-
projectId: "",
25-
storageBucket: "",
26-
messagingSenderId: "",
27-
appId: ""
28-
},
29-
// recaptchaEnterpriseKey: "",
45+
...bootstrapData?.firebase,
46+
geminiApiKey: bootstrapData?.geminiApiKey || '',
47+
viewCodeLink: bootstrapData?.viewCodeLink || '',
48+
viewCodeMessage: bootstrapData?.viewCodeMessage || '',
3049
};
3150

51+
console.log('env',environment)
52+
3253
export const geminiModel = "gemini-2.0-flash";

client/web/angular-customer-app/src/index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
<link rel="icon" type="image/x-icon" href="favicon.ico">
2525
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
2626
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
27+
<script src="/bootstrap.js"></script>
2728
</head>
2829
<body class="mat-typography">
2930
<app-root></app-root>

0 commit comments

Comments
 (0)