|Gil Mizrahi 63ba17c51e update stack lts||2日前|
This started out as a blog post for scotty and friends but I've played with it more since and added a database (persistent-sqlite), user registration and authentication (including cookies and sessions), markdown support and a slightly nicer looking css.
Status: Feel free to play around with it.
REGISTRATION='OpenRegistration' VISIBLE='Public' PORT=8080 SCOTTY_ENV='Development' CONN_STRING='file:/tmp/bullet.db' stack exec -- bulletin-app serve
/tmp/bullet.db is the path to the database file.
Note that Development environment means the insecure flag on the cookies is set off. Using Production environment will set it on.
Right now general registration is turned off but it's possible to turn it on by uncommenting the relevant line at Web.Bulletin.Actions.MyUsers.router. Instead, we invite users to register.
When a user reaches a certain level they can start inviting other people. The leveling formula is described in the Web.Bulletin.Database.RegTokens.calcLevel function.
So once a user posts 10 times they can now invite 2 friends to register. The /invite provides the registration links.
If you are using
REGISTRATION='InvitesOnly', users would only be able to
register via a special link (which each is a single user only invite).
These links can be generated by active users that have reached higher levels, or via the CLI command.
Run the following command to generate an invite:
CONN_STRING='file:/tmp/bullet.db' stack exec -- bulletin-app generate_invites --amount 1
/tmp/bullet.db is the path to the database file,
and then go to the link in the browser to register.
The following settings are available using environment variables:
SCOTTY_ENV: server environment, three options:
Development- (Default) One major thing to note here is that cookies are not flagged as
secureso it can be used without TLS
Production- Cookies are marked as secure so can only really work with TLS.
Testing- Not really in use at the moment, sorry for being lazy and not writing tests.
CONN_STRING- (Required) sqlite3 connection string (see URI filename examples).
VISIBLE- Should the site content be available to users that are not logged in?
Public- (Default) yes.
REGISTRATION- Should registration be available to anyone?
OpenRegistration- (Default) yes.
--help to get a list of commands.
To compile a static executable using docker, uncomment the relevant lines in the
and rebuild with
Or download one from the releases page.