Go to file
Dawid Wysokiński b8bd8cd4df
continuous-integration/drone/push Build is passing Details
chore: README.md (#22)
Reviewed-on: #22
2022-12-07 05:49:08 +00:00
build/docker/sessions chore(deps): update golang docker tag to v1.19.4 (#21) 2022-12-07 04:39:00 +00:00
cmd/sessions feat: session name (#18) 2022-12-02 05:29:11 +00:00
internal feat: session name (#18) 2022-12-02 05:29:11 +00:00
k8s chore: api - update resources 2022-11-27 09:28:49 +01:00
.commitlintrc.yml init 2022-11-17 06:57:04 +01:00
.dockerignore init 2022-11-17 06:57:04 +01:00
.drone.yml feat: govulncheck (#19) 2022-12-04 07:54:54 +00:00
.editorconfig init 2022-11-17 06:57:04 +01:00
.envrc init 2022-11-17 06:57:04 +01:00
.gitignore init 2022-11-17 06:57:04 +01:00
.golangci.yml init 2022-11-17 06:57:04 +01:00
.pre-commit-config.yaml init 2022-11-17 06:57:04 +01:00
Makefile feat: add a new REST endpoint - GET /api/v1/user (#7) 2022-11-21 05:54:42 +00:00
README.md chore: README.md (#22) 2022-12-07 05:49:08 +00:00
go.mod chore(deps): update module go.uber.org/zap to v1.24.0 2022-12-02 06:32:32 +01:00
go.sum chore(deps): update module go.uber.org/zap to v1.24.0 2022-12-02 06:32:32 +01:00
renovate.json init 2022-11-17 06:57:04 +01:00
skaffold.yml chore: README.md (#22) 2022-12-07 05:49:08 +00:00

README.md

sessions

A minimalist backend for sessions-ext.

Getting started

Development

Set up the environment

Prerequisites:

  1. Go (>= 1.19)
  2. Node.js (LTS, needed for commitlint)
  3. Kubernetes (>= 1.25.0)
    1. minikube
    2. Docker Desktop
  4. Docker CLI
  5. Skaffold
  6. pre-commit
  7. IDE/Code editor (e.g. Goland, VSCode, vim, neovim)
  8. direnv (optional, but recommended)
# install git hooks and required tools
make install

# run all required services
skaffold run --port-forward=true --tail=true

# stop all of them
skaffold delete

Run unit tests

At least one of the following is required to run unit tests:

  • Docker (dockertest will spin up a database)
  • Postgres database
# Docker
go test -v ./...

# Postgres database
TESTS_DB_DSN=postgres://sessions:sessions_pass@127.0.0.1/sessions go test -v ./... 

Configuration options

Configuration options can be specified via environment variables.

Env variable Default Description
APP_MODE development Whether to use development or production settings
DB_DSN Required. Syntax: postgres://user:password@host:5432/db?sslmode=disable. Only Postgres is supported.
DB_MAX_OPEN_CONNECTIONS 5 Maximum number of open connections to the database (https://pkg.go.dev/database/sql#DB.SetMaxOpenConns)
DB_MAX_IDLE_CONNECTIONS 2 Maximum number of connections in the idle connection pool (https://pkg.go.dev/database/sql#DB.SetMaxIdleConns)
DB_CONNECTION_MAX_LIFETIME 3m Maximum amount of time a connection may be reused (https://pkg.go.dev/database/sql#DB.SetConnMaxLifetime)
API_SWAGGER_ENABLED false Enables the API documentation endpoints (e.g. /api/v1/swagger/index.html, /api/v1/swagger/doc.json)
API_SWAGGER_HOST Host (name or ip) serving the API (e.g. localhost:8080)
API_SWAGGER_SCHEMES http,https Comma-separated list of protocols
API_CORS_ENABLED false Enables cors headers
API_CORS_ALLOWED_ORIGINS Comma-separated list of allowed domains
API_CORS_ALLOW_CREDENTIALS false Whether requests with credentials are allowed
API_CORS_ALLOWED_METHODS HEAD,GET,POST,PUT Comma-separated list of allowed methods
API_CORS_MAX_AGE 300 Max time to cache response (seconds)

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Dawid Wysokiński - contact@dwysokinski.me