Skip to content
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

Change config dynamically #129

Open
mcblum opened this issue Dec 6, 2017 · 7 comments
Open

Change config dynamically #129

mcblum opened this issue Dec 6, 2017 · 7 comments

Comments

@mcblum
Copy link

mcblum commented Dec 6, 2017

Hello. Thanks for making this package. I have a situation where I need to change the config because different companies can have different providers. Is there any way to set the config after the app has been bootstrapped?

Thank you!
Matt

@ronzeidman
Copy link
Owner

You can bootstrap a few similar new providers instead of extending the built-in ones and choosing which config you want at runtime

@mcblum
Copy link
Author

mcblum commented Dec 6, 2017

Sorry that I'm being dense, but how do I actually bootstrap the providers at runtime? All of the syntax examples basically have you pass in a config.

@ronzeidman
Copy link
Owner

You'll have to pass to the config at bootstrap time and then at runtime you choose which one you want using its name. I could probably add the ability to pass the full provider at runtime instead of just the name, it may even be better in terms of tree shaking (if I make it mandatory), but in the meantime, this is the only option. You could create a fork and add this ability (shouldn't be very hard) and I'll appreciate it if you create a pull request afterward.

@mcblum
Copy link
Author

mcblum commented Dec 7, 2017

I'll give it a shot and see if I can figure it out. The use case for this is that within our app you can't know in advance of loading the app which providers will be available. The reason for that is that one site serves multiple different companies and basically pulls their logo and other information. If we could make our API call, get the data and then bootstrap the providers that would be amazing. Basically expose a addProvider() method and updateProvider() for changes at runtime.

Going to fork and give it a try but I'm a bit out of my depths when it comes to developing packages like this. Probably as good a time as any to learn, though.

@ronzeidman
Copy link
Owner

Good luck!
If you have any questions you are welcome to ask.

@ronzeidman
Copy link
Owner

in the new beta for angular 6 I've added updateProviders function. You can try it.

@MrLuis1
Copy link

MrLuis1 commented May 10, 2024

@ronzeidman Does the updateProviders method still exist in version 10.0.1 of the library? I need to do something similar with Shopify and I can't find any method or way to update the authorizationEndpoint dynamically with the Shopify store domain.

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