/mondaynightpoker-server

Go server for Monday Night Poker

Primary LanguageGoMIT LicenseMIT

mondaynightpoker-server

.github/workflows/ci.yaml

mondaynightpoker-server is the backend application for the Monday Night Poker site (see: mondaynight.bid). The front-end code can be found at github.com/weters/mondaynightpoker-vue.

For more information about the architecture of this open-source project, see the architecture document.

Supported Card Games

  • Acey Deucey
  • BourrĂ©
  • Pass the Poop
  • Poker
    • Pot-Limit Texas Hold'em
    • Little L
    • Seven-card games
      • Follow the Queen
      • Baseball
      • Seven-card Stud
      • Low Card Wild

Getting Started

Prerequisites

  1. Go 1.17+
  2. golangci-lint
  3. Docker
  4. Google reCAPTCHA v3 Secret

Development

  1. Create the dev database
$ make dev-database
  1. Create your public and private keys for JWT signing
$ make keys
  1. Make an admin user
$ go run ./cmd/admin -c user
  1. Run the server
$ MNP_RECAPTCHA_SECRET=X go run ./cmd/server
  1. Verify the server is running
$ curl http://localhost:5000/health
  1. Start the Vue.js front-end. Repo can be found at github.com/weters/mondaynightpoker-vue

Configuration

The service can be configured through two methods:

  1. YAML Configuration: By default, the service will look for config.yaml. You can also change the filename by setting a MNP_CONFIG_FILE environment variable.
  2. Environment Variables: All configuration settings can be set by environment variables. Every variable is prefixed by MNP_ and camelCase is transformed to SNAKE_CASE. Example, jwt.publicKey will become MNP_JWT_PUBLIC_KEY.

Any environment variables take precedence over values defined in YAML. The default configuration values are defined below.

host: https://mondaynight.bid
log:
  level: info
  disableAccessLogs: false
database:
  dsn: postgres://postgres@localhost:5432/postgres?sslmode=disable
  migrationsPath: ./sql
jwt:
  publicKey: .keys/public.pem
  privateKey: .keys/private.key
recaptchaSecret: '-'
startGameDelay: 10
playerCreateDelay: 60
email:
  from: Monday Night Poker <no-reply@mondaynight.bid>
  sender: no-reply@mondaynight.bid
  username: dealer@mondaynight.bid
  password: ""
  host: mail.privateemail.com:587
  templatesDir: templates
  disable: false

You can generate a YAML file with the defaults by running:

$ go run ./cmd/generate-config