WISdoM OSS - Golang Microservice Template

GitHub go.mod Go version (subdirectory of monorepo)

This repository contains the source code for a new microservice. You may use this source code for creating a new microservice which automatically registers at the api gateway and sets up a route on the gateway if needed.

DO NOT FORK THIS REPOSITORY SINCE THE COMMIT HISTORY WILL BE TRANSFERRED INTO THE NEW REPOSITORY

Development Steps

  1. Install Golang on your development machine if not already installed
  2. Download the repository as archive to your development machine
  3. Create a new empty repository for your new service
  4. Decompress the downloaded archive into the empty repository
  5. You may now make your initial commit in the repository
  6. Look for all TODOs in the files and act according to the TODOs
  7. Enjoy writing your own microservice

Configuration

The microservice template is configurable via the following environment variables:

  • CONFIG_LOGGING_LEVEL → Set the logging verbosity [optional, default INFO]
  • CONFIG_API_GATEWAY_HOST → Set the host on which the API Gateway runs on [required]
  • CONFIG_API_GATEWAY_ADMIN_PORT → Set the port on which the API Gateway listens on [required]
  • CONFIG_API_GATEWAY_SERVICE_PATH → Set the path under which the service shall be reachable. Do not prepend the path with /api. Only set the last part of the desired path [required]
  • CONFIG_HTTP_LISTEN_PORT → The port on which the built-in webserver will listen on [optional, default 8000]
  • CONFIG_SCOPE_FILE_PATH → The location where the scope definition file is stored [optional, default `/microservice/res/scope.json]