hano-scraper

module
v0.0.0-...-c891680 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT

README

go-template

SHORT_DESCRIPTION

Title

Build status

dockeri.co

Last release Last Docker tag Last release size GitHub last release date Commits since release

Latest size

GitHub last commit GitHub commit activity GitHub closed PRs GitHub issues GitHub closed issues

Lines of code Code size GitHub repo size Go version

MIT Visitors count

Features

Setup

  1. Use the following command:

    docker run -d qmcgaw/go-template-docker
    

    You can also use docker-compose.yml with:

    docker-compose up -d
    
  2. You can update the image with docker pull qmcgaw/go-template-docker:latest or use one of the tags available

Environment variables
Environment variable Default Possible values Description
HTTP_SERVER_ADDRESS :8000 Valid address HTTP server listening address
HTTP_SERVER_ROOT_URL / URL path HTTP server root URL
HTTP_SERVER_LOG_REQUESTS on on or off Log requests and responses information
HTTP_SERVER_ALLOWED_ORIGINS CSV of addresses Comma separated list of addresses to allow for CORS
HTTP_SERVER_ALLOWED_HEADERS CSV of HTTP header keys Comma separated list of header keys to allow for CORS
METRICS_SERVER_ADDRESS :9090 Valid address Prometheus HTTP server listening address
LOG_LEVEL info debug, info, warning, error Logging level
STORE_TYPE memory memory, json or postgres Data store type
STORE_JSON_FILEPATH data.json Valid filepath JSON file to use if STORE_TYPE=json
STORE_POSTGRES_ADDRESS psql:5432 Valid address Postgres database address if STORE_TYPE=postgres
STORE_POSTGRES_USER postgres Postgres database user if STORE_TYPE=postgres
STORE_POSTGRES_PASSWORD postgres Postgres database password if STORE_TYPE=postgres
STORE_POSTGRES_DATABASE database Postgres database name if STORE_TYPE=postgres
HEALTH_SERVER_ADDRESS 127.0.0.1:9999 Valid address Health server listening address
TZ America/Montreal string Timezone

Development

You can setup your development environment with a Docker development container or locally:

  1. Install Go, Docker and Git

  2. Install Go dependencies with

    go mod download
    
  3. Install golangci-lint

  4. You might want to use an editor such as Visual Studio Code with the Go extension.

Commands available are:

# Build the binary
go build cmd/app/main.go
# Test the code
go test ./...
# Lint the code
golangci-lint run
# Build the Docker image
docker build -t qmcgaw/go-template-docker .

See Contributing for more information on how to contribute to this repository.

TODOs

Directories

Path Synopsis
cmd
app
internal
data
Package data contains a Database interface with multiple implementations.
Package data contains a Database interface with multiple implementations.
data/errors
Package errors contains database errors common to all implementations.
Package errors contains database errors common to all implementations.
data/json
Package json implements a data store using a single JSON file and the memory package.
Package json implements a data store using a single JSON file and the memory package.
data/memory
Package memory implements a data store in memory only.
Package memory implements a data store in memory only.
data/psql
Package psql implements a data store using a client to a Postgres database.
Package psql implements a data store using a client to a Postgres database.
health
Package health contains healthchecking tooling such as an HTTP server and the corresponding HTTP client, only for healthchecks.
Package health contains healthchecking tooling such as an HTTP server and the corresponding HTTP client, only for healthchecks.
metrics
Package metrics contains a metrics interface with methods to modify the metrics for Prometheus.
Package metrics contains a metrics interface with methods to modify the metrics for Prometheus.
models
Package models contains data structures common through the program.
Package models contains data structures common through the program.
processor
Package processor contains operations the server can run and serves as the middle ground between the network server and the data store.
Package processor contains operations the server can run and serves as the middle ground between the network server and the data store.
server/contenttype
Package contenttype contains functions to extract content type information from request headers as well as set correct headers on the response depending on the Accept and Content-Type request headers.
Package contenttype contains functions to extract content type information from request headers as well as set correct headers on the response depending on the Accept and Content-Type request headers.
server/decodejson
Package decodejson has helper functions to decode HTTP bodies encoded in JSON.
Package decodejson has helper functions to decode HTTP bodies encoded in JSON.
server/httperr
Package httperr implements convenience functions to respond with an error to an http client.
Package httperr implements convenience functions to respond with an error to an http client.
server/middlewares/cors
Package cors has a middleware and functions to parse and set CORS correctly.
Package cors has a middleware and functions to parse and set CORS correctly.
server/middlewares/metrics
Package metrics implements a metrics middleware for an HTTP server that records metrics data for Prometheus.
Package metrics implements a metrics middleware for an HTTP server that records metrics data for Prometheus.
server/routes/build
Package build is the HTTP handler for the build information.
Package build is the HTTP handler for the build information.
server/routes/users
Package users is the HTTP handler for the users.
Package users is the HTTP handler for the users.

Jump to

Keyboard shortcuts

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