A few days ago I was tasked with figuring out how Nottingham Hackspace members could request access to the hackspace while it is closed during the UK's lockdown. Part of the solution was having a phone number which, when it received a text, forwarded it on to the board of Trustees. I ended up employing Twillio and a Zapier integration to forward SMSs on to Slack. Twilio sends an auto-reply to SMSs messages received, and it uses the response from a GET request made to a user-provided URL. I didn't particularly want to host a script on one of my servers, along with setting up an nginx route and such because it takes a while to set up and requires me maintaining it, so we ended up sheepishly using scripts.google.com to host the simple script instead.
I wondered if there was a solution to hosting simple, stand-alone scripts behind a url similar to Google Script. Something where I could just have a script print out a response to stdin and then scp it to a directory on a server and have that script available to field requests without any more setup.
I didnt find anything , so I wrote Lambaa.
It is a vibe-d web server which routes any request to a script name, to a script it finds in a given directory. It just passes the request info over stdin, and receives the script's response over the stdout, which it then responds to the original request with. Its fairly simple, and fulfills exactly what I needed it too.
I have. Looks like my search terms were a bit wooly, I didn't manage to describe what I wanted.
But thats fine, I think. I enjoyed writing Lambaa, and it was a great chance to write some Dlang ( not something I have opportunity to do often ). Although it does feel a little like I wasted my time writing lambaa, I learned the following things:
Lambaa is availabe on my GitHub at github.com/samathy/lambaa. Its not particularly useful to you, probably, and needs some more work. But I consider it time-well-spent.
For the future, Lambaa needs:
• Example scripts • Command line configuration for script and log directories • Better docs ( in and out of code ) • Perhaps an interface to upload scripts, or even edit them. ( I could add this as a script itself server by lambaa! ) • More sheep related jokes. • Automated running of the tests I wrote.
Copyright Samathy Barratt 2019