You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Go to file
renovate 6271756188
continuous-integration/drone/push Build is passing Details
chore(deps): update golang docker tag to v1.20.2 (#52)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| golang | stage | patch | `1.20.1-alpine3.17` -> `1.20.2-alpine3.17` |

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNC4xNTIuNCIsInVwZGF0ZWRJblZlciI6IjM0LjE1Mi40In0=-->

Co-authored-by: Renovate <renovate@dwysokinski.me>
Reviewed-on: #52
Co-authored-by: renovate <renovate@noreply.localhost>
Co-committed-by: renovate <renovate@noreply.localhost>
2 weeks ago
build/docker/sessions chore(deps): update golang docker tag to v1.20.2 (#52) 2 weeks ago
cmd/sessions refactor: http server - update timeouts 1 month ago
docs chore: update README.md 3 months ago
internal chore(deps): update module github.com/golangci/golangci-lint to v1.51.2 4 weeks ago
k8s chore: api - update resources 4 months ago
.commitlintrc.yml init 4 months ago
.dockerignore init 4 months ago
.drone.yml chore: update github.com/golangci/golangci-lint to v1.51.0 2 months ago
.envrc init 4 months ago
.gitignore init 4 months ago
.golangci.yml chore: update github.com/golangci/golangci-lint to v1.51.0 2 months ago
.pre-commit-config.yaml chore(deps): update module github.com/golangci/golangci-lint to v1.51.2 4 weeks ago
LICENSE chore: add LICENSE 3 months ago
Makefile feat: add a new REST endpoint - GET /api/v1/user (#7) 4 months ago
README.md chore: update README.md 3 months ago
go.mod chore(deps): update module github.com/uptrace/bun to v1.1.12 4 weeks ago
go.sum chore(deps): update module github.com/uptrace/bun to v1.1.12 4 weeks ago
renovate.json chore: update deps & add skip ci to renovate.json & delete .editorconfig 1 month ago
skaffold.yml chore: README.md (#22) 3 months ago

README.md

sessions

A minimalist backend for sessions-ext.

Getting started

Development

Setting 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)
# if you have direnv installed
direnv allow

# 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

Running 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 ./... 

Creating a new database migration

# create a migration
go run ./cmd/sessions/main.go db migration create go migration 1

img.png

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. Only Postgres is supported. Example: postgres://user:password@host:5432/dbname?sslmode=disable (https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-CONNSTRING)
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