Package configuration via service
See original GitHub issueDescribe the problem you’d like to have solved
My organization does not use the angular environment files for build variables because that method forces the application to be rebuilt in every CI/CD environment which introduces instability. Instead, we include an appSettings.json file with our package and let the application query for environment specific variables on load. This means that configuration via the module.forRoot() parameters isn’t possible as it replies on a typescript file getting compiled into the app.
Describe the ideal solution
Our internal configuration provider package is designed to grab the values out of appSettings and provide them in a service to the app. Ideally Auth0 would give us the option to delay configuration until services are provided like so:
constructor(
public configService: NgAppConfigService,
public auth0: Auth0Service) {
const config = this.configService.getconfig();
this.auth0.initialize(config.auth0Settings);
}
Alternatives and current work-arounds
Our current workaround is to use our internal Auth0 wrapper (@sigao/ng-auth0) that allows for initialization via the service. However, we would like to switch over to using the SDK if possible.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:20
@brandon-sigao We have a solution ready to go, would appreciate your thoughts on it to make sure it would meet your needs: #62
Hey there,
My organization also use a service to resolve environment dynamically, with the
APP_INITIALIZER
provider.With the configuration in the
forRoot
, we aren’t able to use our dynamically load environment.Initializing the auth0 client later in the app process, could be a great improvment