server

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2018 License: GPL-2.0 Imports: 43 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DATABASE_TYPE_DEFAULT = "memory"
	HTTP_PORT_DEFAULT     = 8080 // Port 8080
)

Variables

View Source
var Authent bool = false

If authent == true => then we turn authentication on

View Source
var Password string = ""
View Source
var Username string = ""

Functions

func GenerateRandomBytes

func GenerateRandomBytes(n int) ([]byte, error)

GenerateRandomBytes returns securely generated random bytes. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func GenerateRandomString

func GenerateRandomString(s int) string

GenerateRandomString returns a URL-safe, base64 encoded securely generated random string. It will return an error if the system's secure random number generator fails to function correctly, in which case the caller should not continue.

func InitServer

func InitServer(cfg config.Provider)

The config should contain following keys: runners.queuesize: Max number of jobs in the queue (default 10) runners.nbrunners: Max number of parallel running jobs (default 1) runners.timeout for each running job in Seconds (default 0=unlimited) runners.jobthreads : Number of cpus per bootstrap runner database.type: mysql or memory (default memory) database.user: user to connect to mysql if type is mysql database.host: host to connect to mysql if type is mysql database.port: port to connect to mysql if type is mysql database.pass: pass to connect to mysql if type is mysql database.dbname: name of db to connect to mysql if type is mysql logging.logfile : path to log file: stdout, stderr or any file name (default stderr)

Types

type AuthJson

type AuthJson struct {
	Username string `json:"username"`
	Password string `json:"password`
}

type AuthResponse

type AuthResponse struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
	Token   string `json:"token"`
}

type Claims

type Claims struct {
	Username string `json:"username"`
	// recommended having
	jwt.StandardClaims
}

type ErrorInfo

type ErrorInfo struct {
	Message string
}

type GenericResponse

type GenericResponse struct {
	Status  int    `json:"status"`
	Message string `json:"message"`
}

type GlobalInformation added in v0.1.4

type GlobalInformation struct {
	GalaxyProcessor   bool
	EmailNotification bool
}

Global informations about server given to different templates

type Key

type Key int
const MyKey Key = 0

type MarkDownPage

type MarkDownPage struct {
	Md string
}

Jump to

Keyboard shortcuts

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