Publ: Command-Line Interface

Last updated:

Publ extends the default flask command with some additional commands, which can be used for various useful things. In addition to this page, you can get detailed help from the command line with:

flask publ [command] --help

from within your Publ virtual environment (e.g. pipenv run flask publ --help).

For usage of the flask command itself, see the Flask CLI documentation.

reindex

This command lets you force a database reindex, and will wait until the index finishes. This is useful for deployment scripts and the like.

It takes two arguments:

  • --fresh/-f: Start with a fresh index (i.e. remove all the cached data); this is useful if something weird has happened and you want a fresh start (if something weird has happened, please open an issue!)
  • --quiet/-q: Don’t show the progress indicator

token

This command can be used to generate an IndieAuth token for scripting purposes, such as for use with Pushl, or for testing authentication automatically.

For example:

TOKEN=$(flask publ token https://example.com)

curl -H "Authorization: Bearer $TOKEN" https://example.com/feed

will fetch the https://example.com/feed page with a token identifying the user as https://example.com (as generated by your Publ site).

Note that the session key will need to match between wherever you’re running this and the actual site. If they do not match (for example, because the session key hasn’t been configured, or because you’re running in a different configuration) this token will not be valid.

This takes one argument:

  • --scope/-s: Generate the token with the specified scope (defaults to none)