Go to file
2021-01-03 18:21:42 +01:00
db Protected POST /account and fixed with JWT stuff in general 2021-01-03 18:21:42 +01:00
src Protected POST /account and fixed with JWT stuff in general 2021-01-03 18:21:42 +01:00
.env_example Protected POST /account and fixed with JWT stuff in general 2021-01-03 18:21:42 +01:00
.gitignore Some kind of starting point 2020-12-29 13:46:58 +01:00
go.mod Protected POST /account and fixed with JWT stuff in general 2021-01-03 18:21:42 +01:00
go.sum Protected POST /account and fixed with JWT stuff in general 2021-01-03 18:21:42 +01:00
README.md Protected POST /account and fixed with JWT stuff in general 2021-01-03 18:21:42 +01:00

Databaes migration

Done using dbmate. Db stuff is stored in ./db.

Example of running the migrations:

docker run --rm -it -e DATABASE_URL="postgres://postgres:postgres@127.0.0.1:5432/pwrpln?sslmode=disable" --network=host -v "$(pwd)/db:/db" amacneil/dbmate up

Example of setting up a postgres SQL server:

docker run -d --name postgres --network=host -e POSTGRES_PASSWORD=postgres -e POSTGRES_PASSWORD=postgres -e POSTGRES_DB=pwrlpln postgres

Admin account

On first startup with a clean database, an account with name "admin" and the field "role" with a value "admin" is created with no password, using the API Key from ADMIN_API_KEY in the .env file.

Special account field: "role"

The account field "role" is a bit special, in that if it contains "admin" as one of its values, that grants access to all methods on all accounts on this service. It might be a good idea to use the field "role" for authorization throughout your services.