util

package
v2.5.1+incompatible Latest Latest
Warning

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

Go to latest
Published: May 22, 2018 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Config *configType

Config exposes the application configuration storage for use in the application

Cookie is a runtime generated secure cookie used for authentication

View Source
var InteractiveSetup bool

InteractiveSetup indicates that the cli should perform interactive setup mode

View Source
var Migration bool

Migration indicates that the user wishes to run database migrations, deprecated

View Source
var UpdateAvailable *github.RepositoryRelease

UpdateAvailable contains the full repository information for the latest release of Semaphore

View Source
var Upgrade bool

Upgrade indicates that we should perform an upgrade action

View Source
var WebHostURL *url.URL

WebHostURL is the public route to the semaphore server

Functions

func AuthFailed

func AuthFailed(w http.ResponseWriter, r *http.Request)

AuthFailed write a status unauthorized header unless it is an XHR request TODO - never called!

func CheckUpdate

func CheckUpdate(version string) error

CheckUpdate uses the github client to check for new tags in the semaphore repo

func ConfigInit

func ConfigInit()

ConfigInit reads in cli flags, and switches actions appropriately on them

func DoUpgrade

func DoUpgrade(version string) error

DoUpgrade checks for an update, and if available downloads the binary and installs it

func FindSemaphore

func FindSemaphore() string

FindSemaphore looks in the PATH for the semaphore variable if not found it will attempt to find the absolute path of the first os argument, the semaphore command, and return it

func GetIntParam

func GetIntParam(name string, w http.ResponseWriter, r *http.Request) (int, error)

GetIntParam fetches a parameter from the route variables as an integer redirects to a 404 or writes bad request state depending on error state

func LogError

func LogError(err error)

LogError logs an error with arbitrary field if error

func LogErrorWithFields

func LogErrorWithFields(err error, fields log.Fields)

LogErrorWithFields logs a error with added field context if error

func LogPanic

func LogPanic(err error)

LogPanic logs and panics with arbitrary field if error

func LogPanicWithFields

func LogPanicWithFields(err error, fields log.Fields)

LogPanicWithFields logs and panics with added field context if error

func LogWarning

func LogWarning(err error)

LogWarning logs a warning with arbitrary field if error

func LogWarningWithFields

func LogWarningWithFields(err error, fields log.Fields)

LogWarningWithFields logs a warning with added field context if error

func NewConfig

func NewConfig() *configType

NewConfig returns a reference to a new blank configType nolint: golint

func ScanErrorChecker

func ScanErrorChecker(n int, err error)

ScanErrorChecker deals with errors encountered while scanning lines since we do not fail on these errors currently we can simply note them and move on

func SendMail

func SendMail(emailHost, mailSender, mailRecipient string, mail bytes.Buffer) error

SendMail dispatches a mail using smtp

Types

This section is empty.

Jump to

Keyboard shortcuts

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