Topical is a minimalist message board built with Golang.
Users can create topics and reply with mesages. Users need only to pick an avatar color and two initials to get a signature and start posting.
- Clone this repo
- Navigate into the repo
- Run
touch topical.db && go run ./scripts/db_resetto create the database - Run
go run ./cmd/topical -session-key=secretto start the app - Navigate to
localhost:8000in your browser to use the app
- Run tests by executing
go test ./internal/.... - You can also get coverage information with the
-coverflag (go test ./... -cover)
Topical supports passing options via flag at start up or through an accompanying environment variable. Flags will take precedence over environment variables, if provided.
| Flag | ENV var | Default Fallback | Description |
|---|---|---|---|
p |
PORT |
8000 |
Port for Topical to bind to |
db-file |
DB_FILE |
'topical.db' |
Path to the sqlite3 database file |
session-key |
SESSION_KEY |
'not-set' |
Session key for cookie store |
A few DB management scripts have been provided and will accomplish the following tasks:
| Script | Use |
|---|---|
db_init |
Creates the intial tables in the DB as specified in ./schema.sql |
db_seed |
Seeds an existing database with data from ./seeds.sql |
db_drop |
Drops tables from a Topical database |
db_reset |
Drops tables, creates tables, reseeds database |
Scripts can be run directly with go run:
go run ./scripts/db_init -db-file='topical.db'