GithubHelp home page GithubHelp logo

me98278 / go-quick Goto Github PK

View Code? Open in Web Editor NEW

This project forked from madflojo/go-quick

0.0 0.0 0.0 2.24 MB

A production-ready boilerplate application for Go with Redis.

License: Apache License 2.0

Shell 2.15% Go 94.52% Makefile 2.16% Dockerfile 1.16%

go-quick's Introduction

Go Quick

PkgGoDev Go Report Card Build Status Coverage Status

This project is a boilerplate web application written in Go (Golang).

Starting a new Go Project and wish you had a basic application you could use as a starting point? Want to learn Go but don't know how to structure your project?

The goal of this project is to be all of those things. A clean, straightforward project that offers power users everything they need to start a new Go application. While also providing folks new to Go an example of a well-structured application.

Features

  • Environment Variable and/or HashiCorp Consul-based configuration (spf13/viper)
  • Modular Key-Value Database integration (madflojo/hord)
  • Internal task scheduler for recurring tasks (madflojo/tasks)
  • Live Enable/Disable of debug logging when using Consul for configuration
  • Service Resiliency
    • Liveness probe support via /health end-point
    • Readiness probe support via /ready end-point
    • Graceful shutdown with a SIGTERM signal trap

Getting Started

The easiest way to get started with this project is to run it locally via Docker Compose. Just follow the instructions below, and you will have an entire local instance with dependencies running.

$ docker compose up go-quick

Once running, you can interact with the API via http://localhost/hello

Configuring the Service

This application supports configuring the service from Environment Variables, a JSON file, or using HashiCorp Consul. All of these configuration options can also exist together to provide both static and dynamic configuration.

When using Environment Variables, all configurations are prefixed with APP_. The list below will show both Environment and Consul/JSON format for configuration.

Environment Variable Consul/JSON Type Description
APP_ENABLE_TLS enable_tls bool Enable the HTTPS Listener (default: True)
APP_LISTEN_ADDR listen_addr string Define the HTTP/HTTPS Listener address (default: 0.0.0.0:8443)
APP_CONFIG_WATCH_INTERVAL config_watch_interval integer Frequency in seconds which Consul configuration will be refreshed (default: 15)
APP_USE_CONSUL use_consul bool Enable Consul based configuration (default: False)
APP_CONSUL_ADDR consul_addr string Consul address (i.e. consul.example.com:8500)
APP_CONSUL_KEYS_PREFIX consul_keys_prefix string Key path for app specific consul configuration
from_consul bool Indicator to reflect whether Consul config was loaded
APP_DEBUG debug bool Enable debug logging
APP_TRACE trace bool Enable trace logging
APP_DISABLE_LOGGING disable_logging bool Disable all logging
APP_DB_SERVER db_server string Database server address
APP_DB_PASSWORD db_password string Database password
APP_CERT_FILE cert_file string Certificate File Path (i.e. /some/path/cert.crt)
APP_KEY_FILE key_file string Key File Path (i.e. /some/path/cert.key)

Consul Format

When using Consul the consul_keys_prefix should be the path to a key with a JSON string as the value. For example, a key of go-quick/config will have a value of {"from_consul":true}.

go-quick's People

Contributors

madflojo avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.