unfurl icon indicating copy to clipboard operation
unfurl copied to clipboard

Add a "serve" command line option

Open aszs opened this issue 2 years ago • 0 comments

Let's add a serve command line option that runs unfurl as a simple HTTP server using flask.

The command should take these options: --port (port to run on, default to ??), --address (to bind to, eg. to restrict to localhost), and --secret. If secret is set (also expose as UNFURL_SERVE_SECRET using the click parameter) the api endpoints would require it to match an Authorization header or token query parameter.

Serve would also take the optional ensemble argument just like as the other command and load that ensemble before starting the http server.

The first endpoint we'd want to expose would just be like the export command and it would return the json rendered by export. It should cache the result because the json won't change as this initial implementation loads the ensemble as read-only.

aszs avatar Aug 03 '22 17:08 aszs