common

package
v0.0.0-...-086a27a Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2022 License: Apache-2.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	AppBuildVersion = "0.0.0"
	AppBuildHash    = "???"
	AppBuildDate    = "???"
	AppBuildMode    = "development"
)

misc vars

Functions

func AccountIsAdmin

func AccountIsAdmin(emails []types.GitHubEmail) bool

AccountIsAdmin ... determine if account is an admin

func AddRepoGitHubPrefix

func AddRepoGitHubPrefix(repos []string) (reposModified []string)

AddRepoGitHubPrefix ... add a HTTPS GitHub prefix to a repo link if it's not a valid URL

func EncodeObject

func EncodeObject(obj interface{}) (data []byte, err error)

EncodeObject ... encode any object as JSON, returning as bytes

func GetAdminEmailDomain

func GetAdminEmailDomain() string

GetAdminEmailDomain ... returns the admin email domain of accounts

func GetAppEnvFile

func GetAppEnvFile() (output string)

GetAppEnvFile ... returns the location of an env file to load

func GetAppPort

func GetAppPort() (output string)

GetAppPort ... returns the port to bind to

func GetBaseHost

func GetBaseHost() (host string)

GetBaseHost ... returns the host where the frontend will be served

func GetEmailDomainFromEmail

func GetEmailDomainFromEmail(email string) string

GetEmailDomainFromEmail ... extract the domain from an email address

func GetEnvOrDefault

func GetEnvOrDefault(envName string, defaultValue string) (output string)

GetEnvOrDefault ... returns env value or default to value

func GetGitHubAdminOrgs

func GetGitHubAdminOrgs() []string

GetGitHubAdminOrgs ... returns the GitHub admin orgs

func GetInstanceContainerRegistryMirrors

func GetInstanceContainerRegistryMirrors() []string

GetInstanceContainerRegistryMirrors ... returns the url to a mirror container registry

func GetNonAdminInstanceMaxAmount

func GetNonAdminInstanceMaxAmount() int

GetNonAdminInstanceMaxAmount ... returns the max number of instances for non-admins

func GetPacketProjectID

func GetPacketProjectID() (id string)

GetPacketProjectID ... returns the project ID to create instances in

func GetTargetNamespace

func GetTargetNamespace() (namespace string)

GetTargetNamespace ... returns the namespace to write Kubernetes objects to

func JSONResponse

func JSONResponse(r *http.Request, w http.ResponseWriter, code int, output types.JSONMessageResponse)

JSONResponse .... generic JSON response handler

func Logging

func Logging(next http.Handler) http.Handler

Logging ... basic request logging middleware

func ObjectToUnstructured

func ObjectToUnstructured(obj interface{}) (unstr *unstructured.Unstructured, err error)

ObjectToUnstructured ... convert an object into an unstructured Kubernetes resource

func RandomSequence

func RandomSequence(n int) string

RandomSequence ... generate random string from a set of characters

func ReturnValueOrDefault

func ReturnValueOrDefault(first string, second string) string

ReturnValueOrDefault ... returns first string is not empty, otherwise returns second

func ReverseStringArray

func ReverseStringArray(input []string) []string

ReverseStringArray ... reverse the array order

func ValidateName

func ValidateName(input string) bool

ValidateName ... validates a name string

Types

This section is empty.

Jump to

Keyboard shortcuts

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