fkBootstrap

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 12 Imported by: 1

README

dtx-lib-bootstrap-go

A library to increase the reliability of running and shutting down Go applications.

Usage

package main

import (
	"bitbucket.org/weltcorp/dtx-lib-bootstrap-go"
	"context"
)

func main() {
	ctx := context.Background()

	shutdowns := config.Setup(ctx)
	
	// Example
	go GrpcServer()
	go GatewayServer()

	// ...

	dtxBootstrap.GracefulShutdown(shutdowns)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SERVICE_NAME = "zigot"

Functions

func ChangeWorkingDirectory

func ChangeWorkingDirectory(path string) error

func GetFieldFromStruct

func GetFieldFromStruct(cfg interface{}, field []string) (result map[string]string, err error)

func GetWorkingDir

func GetWorkingDir() string

func GracefulShutdown

func GracefulShutdown(ctx context.Context, funcs Shutdowns)

func IsLocal

func IsLocal(cfg interface{}) bool

func LoadEnv

func LoadEnv(cfg interface{}) error

Types

type Payload

type Payload struct {
	Parse       string `json:"parse,omitempty"`
	Username    string `json:"username,omitempty"`
	IconUrl     string `json:"icon_url,omitempty"`
	IconEmoji   string `json:"icon_emoji,omitempty"`
	Channel     string `json:"channel,omitempty"`
	Text        string `json:"text,omitempty"`
	LinkNames   string `json:"link_names,omitempty"`
	UnfurlLinks bool   `json:"unfurl_links,omitempty"`
	UnfurlMedia bool   `json:"unfurl_media,omitempty"`
	Markdown    bool   `json:"mrkdwn,omitempty"`
}

type Shutdowns

type Shutdowns map[string]func() error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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