server

package
v1.0.2-0...-54bdd54 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const OneMonth = "720h"

Variables

This section is empty.

Functions

func Main

func Main() error

Types

type ClientConfig

type ClientConfig struct {
	Title           string `json:"title"`
	IntroMarkdown   string `json:"introMarkdown"`
	InstallMarkdown string `json:"installMarkdown"`
}

type Handlers

type Handlers struct {
	ServerConfig
	Client  *kotsclient.VendorV3Client
	App     *types.App
	Channel *types.Channel
}

func NewHandlers

func NewHandlers(config ServerConfig) (*Handlers, error)

func (*Handlers) ClientConfig

func (h *Handlers) ClientConfig(c *gin.Context)

func (*Handlers) Healthz

func (h *Handlers) Healthz(c *gin.Context)

func (*Handlers) Submit

func (h *Handlers) Submit(c *gin.Context)

type ProxyPathFunc

type ProxyPathFunc func(c *gin.Context) string

type ServerConfig

type ServerConfig struct {
	GinAddress string `env:"GIN_ADDRESS"`
	GitVersion string `env:"GIT_VERSION"`

	// StaticDir defines where frontend assets should be served from
	// This is designed for production builds where the Gin server serves both the
	// frontend routes from /* and the api routes from /api/*
	StaticDir string `env:"STATIC_DIR"`

	// ProxyFrontend specifies a local URL to use for frontend assets
	// this should only be used when developing locally
	ProxyFrontend    string `env:"PROXY_FRONTEND"`
	ProxyFrontendURL *url.URL

	// frontend / UI settings
	Title           string `json:"title" env:"FORM_TITLE"`
	IntroMarkdown   string `json:"introMarkdown" env:"FORM_INTRO_MARKDOWN"`
	InstallMarkdown string `json:"installMarkdown" env:"FORM_INSTALL_MARKDOWN"`

	// License creation options
	ReplicatedAPIOrigin string `env:"REPLICATED_API_ORIGIN"`
	ReplicatedAPIKey    string `env:"REPLICATED_API_TOKEN"`
	ReplicatedApp       string `env:"REPLICATED_APP"`

	LicenseDuration           string `env:"LICENSE_EXPIRE_DURATION"`
	LicenseExpirationDuration time.Duration

	ReplicatedChannel string `env:"LICENSE_CHANNEL"`
	EnableGitops      bool   `env:"LICENSE_ENABLE_GITOPS"`
	EnableAirgap      bool   `env:"LICENSE_ENABLE_AIRGAP"`
	EnableSnapshots   bool   `env:"LICENSE_ENABLE_SNAPSHOTS"`
	LicenseType       bool   `env:"LICENSE_TYPE"`

	NotificationWebhookURL string `env:"NOTIFICATION_WEBHOOK_URL"`
}

ServerConfig is the environment configuration for the backend process it includes the client config which is served to the frontend on page load

func DefaultConfig

func DefaultConfig() ServerConfig

func LoadConfig

func LoadConfig() (*ServerConfig, error)

type SubmitRequest

type SubmitRequest struct {
	Name  string `json:"name"`
	Org   string `json:"org"`
	Email string `json:"email"`
}

type WebhookNotificationPayload

type WebhookNotificationPayload struct {
	SubmitRequest `json:"inline"`
	CustomerID    string    `json:"customerId"`
	Created       time.Time `json:"created"`
}

Jump to

Keyboard shortcuts

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