You could use a JSON configuration file for this and load it using HTTP. In this case, you could bootstrap your application asynchronously to wait for this configuration data to be loaded. Here is a sample:
let appProviders = [ HTTP_PROVIDERS, ConfigurationService ];
var app = platform(BROWSER_PROVIDERS)
.application([BROWSER_APP_PROVIDERS, appProviders]);
let service = app.injector.get(ConfigurationService);
service.getConfiguration().flatMap((configuration) => {
var configurationProvider = new Provider('configuration', { useValue: configuration });
return app.bootstrap(AppComponent, [ configurationProvider ]);
}).toPromise();
The ConfigurationService
class could be something like that:
@Injectable()
export class ConfigurationService {
constructor(private http:Http) {
}
getConfiguration() {
return this.http.get('config.json').map(res => res.json());
}
}
See this question for more details: