Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme with typo fixes #61

Merged
merged 2 commits into from
Mar 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Go-SSB Room

This repository contains code for a [Secure-Scuttlebutt Room v2](github.com/ssb-ngi-pointer/rooms2/) server writen in Go.
This repository contains code for a [Secure-Scuttlebutt Room v2](https://github.com/ssb-ngi-pointer/rooms2/) server written in Go.

It not only includes the secret-handshake+boxstream setup and muxrpc handlers for tunneling connections but also a fully embedded http/html interface for administering the room.

Expand All @@ -15,7 +15,7 @@ It not only includes the secret-handshake+boxstream setup and muxrpc handlers fo

## Development

The basics just need a recent version of [Go](https://golang.org). v1.14 and onward should be sufficient.
To get started, you need a recent version of [Go](https://golang.org). v1.16 and onward should be sufficient.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!


To build the server and see a list of it's options, run the following:

Expand Down Expand Up @@ -48,26 +48,25 @@ This way it won't use the assets that are embedded in the binary but read them d
Once you are done with your changes run `go generate` in the changed packages to update them.

## Tooling
### Mocks

### mocks

[counterfeiter](https://github.com/maxbrunsfeld/counterfeiter) enables generating mocks for defined interfaces. To update them run `go generate` in package admindb.

TODO: setup tool as dependency (no manual install)

[`counterfeiter`](https://github.com/maxbrunsfeld/counterfeiter) enables generating mocks for defined interfaces. To update the mocks, run `go generate` in package admindb.
* TODO: setup tool as dependency (no manual install)

### Database schema

This project uses [sql-migrate](https://github.com/rubenv/sql-migrate) to upgrate the sqlite database when necessary.
This project uses [sql-migrate](https://github.com/rubenv/sql-migrate) to upgrade the sqlite database when necessary.

Just create a new file in `admindb/sqlite/migrations` with your changes but be reminded: Similar to the web assets, you need to use `go test -tags dev` to test them. Afterwards run `go generate` to embedd them in the code and thus the resulting server binary.
To upgrade, create a new file in `admindb/sqlite/migrations` with your changes.

**Note**: similar to the web assets, you need to use `go test -tags dev` to test them. Afterwards run, `go generate` to embed the assets in the code and thus the resulting server binary.

### No ORM

We use [sqlboiler](github.com/volatiletech/sqlboiler) to generate type-safe Go code code directly from SQL statements and table definitions. This approach suits the programming language much more then classical ORM approaches, which usually rely havily on reflection for (un)packing structs.
We use [sqlboiler](github.com/volatiletech/sqlboiler) to generate type-safe Go code directly from SQL statements and table definitions. This approach suits the programming language much more then classical ORM approaches, which usually rely havily on reflection for (un)packing structs.

To generate them run the following commands. This will populate `admindb/sqlite/models`:
(TODO: automate this with `go generate`)
* (TODO: automate this with `go generate`)

```bash
# also included as generate_models.sh
Expand All @@ -82,18 +81,17 @@ Aside: I would have used `sqlc` since it's a bit more minimal and uses hand writ

### Development user creation

`cmd/insert-user` contains code to create a fallback user. Build it and point it too your database with a username, like so:
`cmd/insert-user` contains code to create a fallback user. Build it and point it to your database with a username:

```bash
cd $src/cmd/insert-user
cd cmd/insert-user
go build
./insert-user $HOME/.ssb-go-room/roomdb my-user
```

Then repeat your password twice and you are all set for development.

## Testing

### Rooms

The folder `tests/nodejs` contains tests against the JavaScript implementation. To run them, install node and npm and run the following:
Expand All @@ -106,12 +104,12 @@ go test

### Web Dashboard

The folders `web/handlers` contain the HTTP handlers for the dashboard. Each subfolder comes with unit tests for the specific area (like `auth`, `news`, etc.). Simply run `go test` in one of them or run `go test ./web/...` in the root of the repo to test them all.
The folder `web/handlers` contains the HTTP handlers for the dashboard. Each subfolder comes with unit tests for the specific area (like `auth`, `news`, etc.). Simply run `go test` in one of them or run `go test ./web/...` in the root of the repo to test them all.

## Authors

* [cryptix](https://github.com/cryptix) (`@p13zSAiOpguI9nsawkGijsnMfWmFd5rlUNpzekEE+vI=.ed25519`)

## License

MIT
MIT