common

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2018 License: MIT Imports: 9 Imported by: 0

README

Common

GoDoc

This package contains utility functions and things shared by both the client and the daemon, such as request structs.

Documentation

Overview

Package common provides utilities, shared variables, and types for both the client and the daemon

Index

Constants

View Source
const (
	// MsgDaemonOK is the OK response upon successfully reaching daemon
	MsgDaemonOK = "I'm a little Webhook, short and stout!"

	// Container is a constant used in HTTP GET query strings
	Container = "container"

	// Stream is a constant used in HTTP GET query strings
	Stream = "stream"

	// Entries is a constant used in HTTP GET query strings
	Entries = "entries"
)

Variables

This section is empty.

Functions

func CheckForDockerCompose

func CheckForDockerCompose(cwd string) bool

CheckForDockerCompose returns false if current directory is a not a docker-compose project

func CheckForDockerfile added in v0.3.0

func CheckForDockerfile(cwd string) bool

CheckForDockerfile returns false if current directory is a not a Dockerfile project

func CheckForProcfile added in v0.4.0

func CheckForProcfile(cwd string) bool

CheckForProcfile returns false if current directory is not a Heroku project

func ExtractRepository added in v0.4.0

func ExtractRepository(URL string) string

ExtractRepository gets the project name from its URL in the form [username]/[project]

func GenerateRandomString added in v0.4.0

func GenerateRandomString() (string, error)

GenerateRandomString creates a rand.Reader-generated string for use with simple secrets and identifiers

func GetBranchFromRef added in v0.1.1

func GetBranchFromRef(ref string) string

GetBranchFromRef gets the branch name from a git ref of form refs/...

func GetFullPath added in v0.4.0

func GetFullPath(relPath string) (string, error)

GetFullPath returns the absolute path of the config file.

func GetSSHRemoteURL

func GetSSHRemoteURL(url string) string

GetSSHRemoteURL gets the URL of the given remote in the form "git@github.com:[USER]/[REPOSITORY].git"

func ParseDate added in v0.4.0

func ParseDate(dateString string) *time.Time

ParseDate parses a date in format "2006-01-02T15:04:05.000Z"

func ParseInt64 added in v0.4.0

func ParseInt64(value string) (int64, error)

ParseInt64 parses a string into an int64 value

func RemoveContents

func RemoveContents(directory string) error

RemoveContents removes all files within given directory, returns nil if successful

Types

type DeploymentStatus added in v0.3.0

type DeploymentStatus struct {
	InertiaVersion       string   `json:"version"`
	Branch               string   `json:"branch"`
	CommitHash           string   `json:"commit_hash"`
	CommitMessage        string   `json:"commit_message"`
	BuildType            string   `json:"build_type"`
	Containers           []string `json:"containers"`
	BuildContainerActive bool     `json:"build_active"`
}

DeploymentStatus lists details about the deployed project

type DevNull added in v0.4.1

type DevNull struct{}

DevNull writes to null, since a nil io.Writer will break shit

func (DevNull) Write added in v0.4.1

func (dn DevNull) Write(p []byte) (n int, err error)

type EnvRequest added in v0.4.0

type EnvRequest struct {
	Name    string `json:"name,omitempty"`
	Value   string `json:"value,omitempty"`
	Encrypt bool   `json:"encrypt,omitempty"`

	Remove bool `json:"remove,omitempty"`
}

EnvRequest represents a request to manage environment variables

type GitOptions

type GitOptions struct {
	RemoteURL string `json:"remote"`
	Branch    string `json:"branch"`
}

GitOptions represents GitHub-related deployment options

type UpRequest added in v0.4.0

type UpRequest struct {
	Stream        bool        `json:"stream"`
	Project       string      `json:"project"`
	BuildType     string      `json:"build_type"`
	BuildFilePath string      `json:"build_file_path"`
	GitOptions    *GitOptions `json:"git_options"`
	WebHookSecret string      `json:"webhook_secret"`
}

UpRequest is the configurable body of a UP request to the daemon.

type UserRequest added in v0.3.0

type UserRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
	Email    string `json:"email"`
	Admin    bool   `json:"admin"`
}

UserRequest is used for logging in or modifying users

Jump to

Keyboard shortcuts

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