Hey there,
Within an Ionic 2 app, is it possible to provide a configuration file that can be injected into my application with difference values for a development vs a production build?
AKA, within a component I could have:
import { Component } from '@angular/core';
import { CustomConfig } from 'ionic-angular';
@Component({
selector: 'my-component',
templateUrl: 'my-component.html'
})
export class MyComponent {
constructor(
private config: CustomConfig
) {
console.log(this.config.databaseUrl);
}
}
And my custom config file could be something down the lines of:
{
$development: {
databaseUrl: 'http://localhost:4567'
},
$production: {
databaseUrl: 'https://my.database.com'
}
}
Then when I’m developing with ionic serve
it would use the $development
configuration and when building with ionic build ios --prod
it would use the $production
configuration.
Is this built in by default?