CSH annual Death by Dagger backend and slack bot. Written in Go. Death by Dagger is a game where players try to assassinate (poke) each other. Each player is assigned another in a large circularly linked list. In the past, Death by Dagger has been managed by hand by gamemasters. This program makes it easier to manage players.
- Go >= 1.10
- PostgreSQL
This project requires the use of environment variables.
Environment Variable | Description |
---|---|
SERVER_ADDR |
Address to serve on |
PUBLIC_ADDR |
Publicly accessible address for the server, requires schema |
ALLOWED_ORIGINS |
|
DATABASE_ADDR |
Database Address |
DATABASE_NAME |
Database Name |
DATABASE_USERNAME |
Database Username |
DATABASE_PASSWORD |
Database password |
COOKIE_STORE_SECRET |
base64 encoded key to use for encrypting cookies |
SECURE_COOKIE |
Enable 'secure' flag on cookies |
OPENID_AUTH_DOMAIN |
Address of the openid Auth0 domain |
OPENID_CLIENT_ID |
Auth0 Client ID |
OPENID_CLIENT_SECRET |
Auth0 Client Secret |
SERVER_COOKIE_DOMAIN |
Cookie URL domain |
SERVER_REDIRECT_PATH |
URL to redirect user to after a successful login |
SLACK_BOT_TOKEN |
Slack token for bot for interactive messages |
SLACK_BOT_ID |
Slack ID for bot |
SLACK_VERIF_TOKEN |
Slack OAUTH token for bot for interactive messages |
LDAP_URL |
URL to connect to LDAP service on |
LDAP_PORT |
Port to connect to LDAP service on |
LDAP_USER |
Username to log into LDAP with |
LDAP_PASS |
Password to log into LDAP with |
The cookies fields are deprecated, but if you want to create a frontend, there are appropriate websocket endpoints. You'll need to get the LDAP creds for the program from an RTP.
If you choose to go the slackbot route, you'll need the bot id, token, and a separate token to verify that the message actually came from slack. All of that data cna be found at Slack's bot dashboard, after you've created your bot.
Honestly very easy, just create a PostgreSQL database with username/password that you set variables for. Check out PGSQL docs for help with that.
Make sure you got thos Beans environment variables, then:
go get andreweggleston/DeathByDagger
cd $(GOPATH)/src/github.com/andreweggleston/DeathByDagger
Everything goes in the folder its named after:
Models in models Controllers in controllers Database in database Routes in routes.go Helpers in models
- Fork this project.
- Make your branch! (
git checkout -b branch_name
) - Commit and push your changes. (
git commit
and thengit push origin branch_name
). - Make a PR.
Before making a PR, make your code matches Go style guidlines (just run
go fmt
), and squash your commits.
I wanted to learn Go in more than just a basic sense, and didn't have experience with databases at all. The amounts of players are nowhere near the amount that a PSQL database is needed at, but it seemed like a good idea to learn at least the syntax to interact with databases. As far as why I made it this way, the structure of the project itself follows that of a normal web project, as I outlined above.