flexo

command module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2022 License: MIT Imports: 1 Imported by: 0

README

Flexo

BING BONG GitHub tag (latest SemVer) Docker build status License GitHub contributors

Quickstart

Running with docker-compose

SECRET=zbeul DB_USER=flexo docker-compose up

All 3 config variables default to flexo, but DB_USER must be specified in the command so that the health check can execute successfully. SECRET is the secret shared between the frontend and the backend. It defaults to "shared_secret"

DBSSL sets the connection to the database's ssl mode options. It is set to disable by default.

Testing

Resetting the database

If you want a clean database, you have to stop the docker compose stack, remove the docker compose stack, then delete the docker volume with the DB data before starting the stack again.

➜  flexo  git:(main) ✗ docker volume list
DRIVER              VOLUME NAME
local               flexo_db-data

➜  flexo  git:(main) ✗ docker-compose rm -f
Going to remove flexo_flexo_1, flexo_db_1
Removing flexo_flexo_1 ... done
Removing flexo_db_1    ... done

➜  flexo  git:(main) ✗ docker volume rm flexo_db-data
flexo_db-data
Building fresh code

docker-compose up --build -d

Authentication and Authorization

The shared secret is used like a very basic JWT. Authorization header must have a value of Bearer $secret.

http -v --auth-type=jwt --auth="test" "localhost:8080/report/team/1"

You need the httpie-jwt-auth plugin to run this command.

Adding mock data

From the faker directory, go run ./main.go

Sending an event

http --json post http://localhost:8080/event targets:='[1,2,3]' teams:='[1,2,3]' category:=1 description="test event"

Get teams

http localhost:8080/teams

Get categories

http localhost:8080/categories

Get events

http localhost:8080/events

Get targets

http localhost:8080/targets

Getting a team report

http localhost:8080/report/team/$ID where $ID is the team's ID.

Getting all teams report

http localhost:8080/report/teams return a json list of each team with their associated report

Documentation

Overview

Copyright © 2021 Bren 'fraq' Briggs ([email protected])

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL