This week, I put together a new helper module to let you view and manage the key/value pairs stored with the store.lua module. The code and instructions are at the bottom if you want to skip the rest of the article.
There’s no question about it: store.lua is absolutely my favourite module to use in IGUANA.
If you’re not familiar with store.lua, I suggest you have a look. It provides you with the ability to have simple, persistent storage in/across your Translator instances.
When would I use this?
Any time you want to persist some data beyond the singular run of the translator, store.lua might be a good idea. Here’s a few places where I’ve used it in the past:
- To keep a count of each message type I’ve received. ex. store.put(msgType, count+1)
- To limit the number of connections made to an external webservice – regardless of how the channel’s properties are set. ex. if os.ts.difftime(os.ts.gmtime(), store.get(‘lastUpdate’)) > 200 then…
- To store configuration or password information used by multiple channels.
What does the viewer do?
Last week, a customer wrote to me saying that they were thinking of using store.lua as a way to manage channel specific configurations. Needless to say, I was all ears. The problem however, was that there was no easy way for their team to see and manage what values were currently stored in the back-end.
With that in mind (and a deadline to make a new blog post), I thought it was time for me to go back to my developer roots and throw together another “Artful Integration”.
It may not be the most elaborate of my creations, but if you’re like me and you love store.lua, this little utility just might become one of your favourites as well.
How it works:
It’s actually quite simple. Loading the UI page will display a table of all the values you have saved using store.lua’s “put” function. Beyond just viewing the key/value pairs however, I also added the ability to:
- Add new entries.
- Update existing entries (just click on any of the values and edit in place).
- Delete entries.
To use It:
1. Create a new channel.
Source: From HTTPs
Destination: To Channel
URL path: whatever you want (ex. /view/)
2. Import this project: Store_Viewer_From_HTTPS
3. Save a milestone.
4. Start the channel.
5. Browse to your URL. (example: http://localhost:6544/view)
I’ve done my best (well, the best I can do in a matter of a few hours) to ensure it works in most browsers. Having said that, like all “Artful Integrations”, this is a creation that is in no way supported or endorsed by iNTERFACEWARE. It’s a rouge utility.
But, … my stuff generally works. So, give it a shot.
As always, please don’t be shy to share your ideas and requests with me. I love a good challenge and I’m always looking for ideas for my next project. If there’s something you’d like to see, leave me a comment below.