Skip to content

Firebase Angular 4 Initialize based on node environment #1285

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

Closed
ishaqbhojani opened this issue Oct 19, 2017 · 1 comment
Closed

Firebase Angular 4 Initialize based on node environment #1285

ishaqbhojani opened this issue Oct 19, 2017 · 1 comment

Comments

@ishaqbhojani
Copy link

ishaqbhojani commented Oct 19, 2017

I've built my Angular 4 project using the Angular CLI. I am deploying my app on Heroku, I've created heroku pipelines for dev and production environment. I have two firebase database dev and production and I want my angular 2 apps to connect to the firebase database based on heroku config variables

I searched on google and found this answer helpful as @yoni-rabinovitch suggested to send an HTTP request on node server to check for the environment when the app initializes.

I am a beginner in Angular 4 and typescript and all I need to implement is to send an HTTP request and initialize the firebase module based on the response.

app.module.ts

import { environment } from '../environments/environment';

@NgModule({
  declarations: [
    AppComponent
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    FormsModule,
    ReactiveFormsModule,
    BrowserAnimationsModule,
    AngularFireModule.initializeApp(environment.firebase)
  ],
  bootstrap: [AppComponent]
})
export class AppModule {}

Any help would be highly appreciated.

@peterennis
Copy link
Contributor

Have a look at this:
#1281

It points to a repo that may help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants