💾 Archived View for gemini.panda-roux.dev › log › entry › 61 captured on 2023-01-29 at 02:33:46. Gemini links have been rewritten to link to archived content

View Raw

More Information

-=-=-=-=-=-=-

MoonGem 2.2 - Script Mode

Posted on Friday July 22, 2022

Script Mode

MoonGem version 2.2

I pushed an update to MoonGem earlier. It now supports running one-off scripts absent of any kind of networking or server logic.

moongem --script=hello.lua

This command will run the contents of `hello.lua` inside MoonGem's scripting environment. Any content rendered by this script will be written to stdout.

This mode of execution also supports specifying a URI to provide to the script in order to simulate a real-world gemini request.

moongem -s test-input.lua gemini://panda-roux.dev/input.gmi?watermelon

The existing server mode behavior remains unchanged.

I added this feature in order to simplify testing. Previously if I wanted to test a dynamic page, I'd have to generate a cert, start MoonGem on a background process, call a command-line client like gmni, look at the results, and kill the server. Now I can test scripts with a single command, no other steps required.

In addition to facilitating testing, being able to generate a dynamic gemtext doc from the command-line could be used for certain server-side use cases.

Docker

I have added a Dockerfile for containerization purposes, and pushed a pre-built image to Docker Hub. I'll work on setting up a compose file sometime soon.

pandarouxdev/moongem

The Dockerfile itself

- panda-roux -

next: "Finally Moved"

prev: "Moving Drama"

Email me about this post

Leave a comment

index

home