server

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2021 License: BSD-2-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultHmacAuthConfig is the default HmacAuth middleware config.
	DefaultHmacAuthConfig = HmacAuthConfig{
		Skipper:   middleware.DefaultSkipper,
		Validator: DefaultHmacAuthValidator,
	}
)

Functions

func DefaultHmacAuthValidator

func DefaultHmacAuthValidator(payload []byte, secret string, signature string, c echo.Context) (bool, error)

func HmacAuth

func HmacAuth(secret string) echo.MiddlewareFunc

HmacAuth returns an HmacAuth middleware.

For valid hash it calls the next handler. For missing or invalid hash, it sends "403 - Forbidden" response.

func HmacAuthWithConfig

func HmacAuthWithConfig(config HmacAuthConfig) echo.MiddlewareFunc

HmacAuthWithConfig returns an HmacAuth middleware with config. See `HmacAuth()`.

func StartServer

func StartServer(cfgfile string)

Types

type Build

type Build struct {
	ID        string
	Queue     string
	Status    string // waiting, building, failure success
	Logfile   string
	Startdate time.Time
	Enddate   time.Time
}

func (*Build) LogfileContent

func (b *Build) LogfileContent() string

func (*Build) Runtime

func (b *Build) Runtime() string

type Config

type Config struct {
	Workdir   string
	Logdir    string
	Staticdir string
	Tmpldir   string
	Server    struct {
		Host    string
		BaseURL string
		TLScert string
		TLSkey  string
	}
	Webhook struct {
		Secret string
	}
	Notification struct {
		StatusAPI struct {
			Token string
		}
		Email struct {
			SmtpHost string
			SmtpUser string
			SmtpPass string
			From     string
		}
	}
	Queues        []Queue
	DefaultQueues []string `yaml:"default_queues"`
}

type Controller

type Controller struct {
	// contains filtered or unexported fields
}

func (*Controller) Serve

func (c *Controller) Serve()

type GitPushEventData

type GitPushEventData struct {
	Branch     string `json:"ref"`
	Repository struct {
		Name      string `json:"name"`
		FullName  string `json:"full_name"`
		HTMLURL   string `json:"html_url"`
		StatusURL string `json:"statuses_url"`
		CloneURL  string `json:"clone_url"`
	} `json:"repository"`
	Commits []struct {
		CommitID string `json:"id"`
		Message  string `json:"message"`
		URL      string `json:"url"`
		Author   struct {
			Name     string `json:"name"`
			EMail    string `json:"email"`
			Username string `json:"username"`
		} `json:"author"`
		Added    []string `json:"added"`
		Removed  []string `json:"removed"`
		Modified []string `json:"modified"`
	} `json:"commits"`
}

func (*GitPushEventData) ShortBranch

func (d *GitPushEventData) ShortBranch() string

type HmacAuthConfig

type HmacAuthConfig struct {
	// Skipper defines a function to skip middleware.
	Skipper middleware.Skipper

	// Validator is a function to validate HmacAuth hash.
	// Required.
	Validator HmacAuthValidator

	// Secret is a string that contains the secret to build the hash.
	Secret string
}

HmacAuthConfig defines the config for HmacAuth middleware.

type HmacAuthValidator

type HmacAuthValidator func([]byte, string, string, echo.Context) (bool, error)

HmacAuthValidator defines a function to validate HmacAuth credentials.

type Job

type Job struct {
	ID        string
	Port      string
	Startdate time.Time
	Enddate   time.Time
	Build     map[string]*Build
	PushEvent GitPushEventData
	CommitIdx int
	BaseURL   string
	Nonce     string
}

func (*Job) EndDate

func (j *Job) EndDate() string

func (*Job) JobRuntime

func (j *Job) JobRuntime() string

func (*Job) Progress

func (j *Job) Progress() int

func (*Job) ShortCommitID

func (j *Job) ShortCommitID() string

func (*Job) ShortCommitMessage

func (j *Job) ShortCommitMessage() string

func (*Job) StartDate

func (j *Job) StartDate() string

func (*Job) StatusOverall

func (j *Job) StatusOverall() string

func (*Job) TimeNow

func (j *Job) TimeNow() string

type Jobs

type Jobs struct {
	Filter string
	Jobs   []Job
	Nonce  string
}

type Queue

type Queue struct {
	Name        string
	Recipe      string
	Environment map[string]string
	Workdir     string
	PathMatch   string
	Queue       chan *Job
}

type Template

type Template struct {
	// contains filtered or unexported fields
}

func (*Template) Render

func (t *Template) Render(w io.Writer, name string, data interface{}, c echo.Context) error

Jump to

Keyboard shortcuts

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