3 ms·
If you try to fetch values and there is no connection nor ached values, the client won't be able to hit Config.ly's servers. I think it's a good idea to implem
by jeremyis 6y ago
If you try to fetch values and there is no connection nor ached values, the client won't be able to hit Config.ly's servers. I think it's a good idea to implement Config.ly with graceful degradation if you are concerned about this case (e.g. "configly.get(key) || "default_value"); though it should only happen in this specific use case.
If you lose internet while using it, the values could be cached and it will work well.
We have a graceful degradation feature on the roadmap; something like hard-coding fallback values in case of offline issues like this. Something like:
configly.init(API_KEY, {
default_values: {
price: '$1,000,000',
upgrades: ['AC', 'Hot rod red'],
}
)
What do you think?
- 0x62 6y agoPerhaps instead of hard coding the fallback, offer a Webpack plugin that fetches the latest config at build. That way long as you've got internet at your build step, you'll always have a recent version.
- jeremyis 6y agoThis is BRILLIANT! Thanks for the suggestion.
- capableweb 6y agoSupport something like local, checked in .env file (dotenv) but with the format you use in your service. Add in export from the UI so you can download it to local before going offline and it's a pretty good fallback.
- jeremyis 6y agoThis is also a great idea. I really like the idea of having a tool to fetch the values from Config.ly and make that part of the build process. Thanks!