types

package
v0.15.3 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OPENRUN_HOME            = "OPENRUN_HOME"
	ID_PREFIX_APP_PROD      = "app_prd_"
	ID_PREFIX_APP_DEV       = "app_dev_"
	ID_PREFIX_APP_STAGE     = "app_stg_"
	ID_PREFIX_APP_PREVIEW   = "app_pre_"
	ID_PREFIX_SERVER        = "srv_id_"
	INTERNAL_URL_PREFIX     = "/_openrun"
	WEBHOOK_URL_PREFIX      = "/_openrun_webhook"
	APP_INTERNAL_URL_PREFIX = "/_openrun_app"
	INTERNAL_APP_DELIM      = "_cl_"
	STAGE_SUFFIX            = INTERNAL_APP_DELIM + "stage"
	PREVIEW_SUFFIX          = INTERNAL_APP_DELIM + "preview"
	NO_SOURCE               = "-" // No source url is provided
)
View Source
const (
	TL_CONTEXT                  = "TL_context"
	TL_DEFER_MAP                = "TL_defer_map"
	TL_CURRENT_MODULE_FULL_PATH = "TL_current_module_full_path"
	TL_PLUGIN_API_FAILED_ERROR  = "TL_plugin_api_failed_error"
	TL_CONTAINER_URL            = "TL_container_url"
	TL_AUDIT_OPERATION          = "TL_audit_operation"
	TL_AUDIT_TARGET             = "TL_audit_target"
	TL_AUDIT_DETAIL             = "TL_audit_detail"
	TL_CONTAINER_MANAGER        = "TL_container_manager"
	TL_BRANCH                   = "TL_branch"
	TL_DEV                      = "TL_dev"
	TL_APP_URL                  = "TL_app_url"
)
View Source
const (
	CONTAINER_SOURCE_AUTO         = "auto"
	CONTAINER_SOURCE_NIXPACKS     = "nixpacks"
	CONTAINER_SOURCE_IMAGE_PREFIX = "image:"
	CONTAINER_LIFETIME_COMMAND    = "command"
)
View Source
const (
	ANONYMOUS_USER = "anonymous"
	ADMIN_USER     = "admin"
)
View Source
const (
	LIB_PATH = "static/gen/lib"
	ESM_PATH = "static/gen/esm"
)
View Source
const (
	SAML_SESSION_KV_PREFIX      = "saml_session:"
	OAUTH_SESSION_KV_PREFIX     = "oauth_session:"
	CONSTANT_KV_PREFIX          = "constant:"
	COOKIE_SESSION_SECRET_KV    = "cookie_session_secret"
	COOKIE_SESSION_BLOCK_KEY_KV = "cookie_session_block_key"
)
View Source
const MessageTypeAppUpdate = "app_update"
View Source
const MessageTypeConfigUpdate = "config_update"
View Source
const REGEX_PREFIX = "regex:"

Variables

This section is empty.

Functions

func GetAppUrl added in v0.14.8

func GetAppUrl(appPathDomain AppPathDomain, serverConfig *ServerConfig) string

func GetHTTPHeader

func GetHTTPHeader(header http.Header, key string) string

GetHTTPHeader returns the first value of the header with the given key. The key has to be a HTTP Canonical Header Key (case is important)

func RegexMatch

func RegexMatch(perm, entry string) (bool, error)

func RollingFileLogger

func RollingFileLogger(config *LogConfig, logType string) io.Writer

func StripQuotes

func StripQuotes(s string) string

Types

type AccountLink struct {
	Plugin      string `json:"plugin"`
	AccountName string `json:"account_name"`
}

AccountLink links the account to use for each plugin

type AppApplyResponse

type AppApplyResponse struct {
	DryRun         bool                `json:"dry_run"`
	CommitId       string              `json:"commit_id"`
	SkippedApply   bool                `json:"skipped_apply"`
	CreateResults  []AppCreateResponse `json:"create_results"`
	UpdateResults  []AppPathDomain     `json:"update_results"`
	ApproveResults []ApproveResult     `json:"approve_results"`
	PromoteResults []AppPathDomain     `json:"promote_results"`
	ReloadResults  []AppPathDomain     `json:"reload_results"`
	SkippedResults []AppPathDomain     `json:"skipped_results"`
	FilteredApps   []AppPathDomain     `json:"filtered_apps"`
}

type AppApplyResult

type AppApplyResult struct {
	DryRun        bool              `json:"dry_run"`
	CreateResult  AppCreateResponse `json:"create_result"`
	ApproveResult *ApproveResult    `json:"approve_result"`
	Updated       []AppPathDomain   `json:"updated"`
	Reloaded      []AppPathDomain   `json:"reloaded"`
	Skipped       []AppPathDomain   `json:"skipped"`
	Promoted      bool              `json:"promoted"`
}

type AppApproveResponse

type AppApproveResponse struct {
	DryRun              bool            `json:"dry_run"`
	StagedUpdateResults []ApproveResult `json:"staged_update_results"`
	PromoteResults      []AppPathDomain `json:"promote_results"`
}

type AppAuthnType

type AppAuthnType string

AppAuthnType is the app level authentication type

const (
	AppAuthnNone    AppAuthnType = "none"    // No auth
	AppAuthnDefault AppAuthnType = "default" // Use whatever auth is the default for the system
	AppAuthnSystem  AppAuthnType = "system"  // Use the system admin user
)

type AppConfig

type AppConfig struct {
	CORS      CORS      `toml:"cors"`
	Container Container `toml:"container"`
	Proxy     Proxy     `toml:"proxy"`
	FS        FS        `toml:"fs"`
	Audit     Audit     `toml:"audit"`
	Security  Security  `toml:"security"`
	StarBase  string    `toml:"star_base"` // The base directory for starlark config files
}

type AppCreateResponse

type AppCreateResponse struct {
	AppPathDomain  AppPathDomain   `json:"app_path_domain"`
	DryRun         bool            `json:"dry_run"`
	HttpUrl        string          `json:"http_url"`
	HttpsUrl       string          `json:"https_url"`
	ApproveResults []ApproveResult `json:"approve_results"`
	OrigSourceUrl  string          `json:"orig_source_url"`
	SourceUrl      string          `json:"source_url"`
}

type AppDeleteResponse

type AppDeleteResponse struct {
	DryRun  bool      `json:"dry_run"`
	AppInfo []AppInfo `json:"app_info"`
}

type AppEntry

type AppEntry struct {
	Id         AppId       `json:"id"`
	Path       string      `json:"path"`
	Domain     string      `json:"domain"`
	MainApp    AppId       `json:"main_app"` // the id of the app that this app is linked to
	SourceUrl  string      `json:"source_url"`
	IsDev      bool        `json:"is_dev"`
	UserID     string      `json:"user_id"`
	CreateTime *time.Time  `json:"create_time"`
	UpdateTime *time.Time  `json:"update_time"`
	Settings   AppSettings `json:"settings"` // settings are not version controlled
	Metadata   AppMetadata `json:"metadata"` // metadata is version controlled
}

AppEntry is the application configuration in the DB

func (*AppEntry) AppPathDomain

func (ae *AppEntry) AppPathDomain() AppPathDomain

func (*AppEntry) String

func (ae *AppEntry) String() string

type AppFile

type AppFile struct {
	Name string
	Etag string
	Size int64
}

type AppGetResponse

type AppGetResponse struct {
	AppEntry AppEntry `json:"app_entry"`
}

type AppId

type AppId string

AppId is the identifier for an App

type AppInfo

type AppInfo struct {
	AppPathDomain
	Name       string
	Id         AppId
	IsDev      bool
	MainApp    AppId
	Auth       AppAuthnType
	SourceUrl  string
	Spec       AppSpec
	Version    int
	GitSha     string
	GitMessage string
	Branch     string
	StarBase   string
}

AppInfo is the basic info for an app

func CreateAppInfo

func CreateAppInfo(id AppId, name, path, domain string, isDev bool, mainApp AppId,
	auth AppAuthnType, sourceUrl string, spec AppSpec,
	version int, gitSha, gitMessage, branch, starBase string) AppInfo

type AppLinkAccountResponse

type AppLinkAccountResponse struct {
	DryRun              bool            `json:"dry_run"`
	StagedUpdateResults []AppPathDomain `json:"staged_update_results"`
	PromoteResults      []AppPathDomain `json:"promote_results"`
}

type AppListResponse

type AppListResponse struct {
	Apps []AppResponse `json:"apps"`
}

type AppMetadata

type AppMetadata struct {
	Name             string            `json:"name"`
	VersionMetadata  VersionMetadata   `json:"version_metadata"`
	Loads            []string          `json:"loads"`
	Permissions      []Permission      `json:"permissions"`
	Accounts         []AccountLink     `json:"accounts"`
	ParamValues      map[string]string `json:"param_values"`
	Spec             AppSpec           `json:"spec"`
	SpecFiles        *SpecFiles        `json:"spec_files"`
	ContainerOptions map[string]string `json:"container_options"`
	ContainerArgs    map[string]string `json:"container_args"`
	ContainerVolumes []string          `json:"container_volumes"`
	AppConfig        map[string]string `json:"appconfig"`
}

AppMetadata contains the configuration for an app. App configurations are version controlled.

type AppMetadataConfigType

type AppMetadataConfigType string
const (
	AppMetadataAppConfig        AppMetadataConfigType = "app_config"
	AppMetadataContainerOptions AppMetadataConfigType = "container_options"
	AppMetadataContainerArgs    AppMetadataConfigType = "container_args"
	AppMetadataContainerVolumes AppMetadataConfigType = "container_volumes"
)

type AppPathDomain

type AppPathDomain struct {
	Path   string
	Domain string
}

AppPathDomain is a unique identifier for an app, consisting of the path and domain

func CreateAppPathDomain

func CreateAppPathDomain(path, domain string) AppPathDomain

func (AppPathDomain) String

func (a AppPathDomain) String() string

type AppPreviewResponse

type AppPreviewResponse struct {
	DryRun        bool          `json:"dry_run"`
	HttpUrl       string        `json:"http_url"`
	HttpsUrl      string        `json:"https_url"`
	Success       bool          `json:"success"`
	ApproveResult ApproveResult `json:"approve_result"`
}

type AppPromoteResponse

type AppPromoteResponse struct {
	DryRun         bool            `json:"dry_run"`
	PromoteResults []AppPathDomain `json:"promote_results"`
}

type AppReloadOption

type AppReloadOption string
const (
	AppReloadOptionNone    AppReloadOption = "none"
	AppReloadOptionUpdated AppReloadOption = "updated"
	AppReloadOptionMatched AppReloadOption = "matched"
)

type AppReloadResponse

type AppReloadResponse struct {
	DryRun         bool            `json:"dry_run"`
	ReloadResults  []AppPathDomain `json:"reload_results"`
	ApproveResults []ApproveResult `json:"approve_results"`
	PromoteResults []AppPathDomain `json:"promote_results"`
	SkippedResults []AppPathDomain `json:"skipped_results"`
}

type AppReloadResult

type AppReloadResult struct {
	DryRun         bool            `json:"dry_run"`
	ReloadResults  []AppPathDomain `json:"reload_results"`
	ApproveResult  *ApproveResult  `json:"approve_result"`
	PromoteResults []AppPathDomain `json:"promote_results"`
	SkippedResults []AppPathDomain `json:"skipped_results"`
}

type AppResponse

type AppResponse struct {
	AppEntry
	StagedChanges bool `json:"staged_changes"`
}

type AppSettings

type AppSettings struct {
	AuthnType          AppAuthnType  `json:"authn_type"`
	GitAuthName        string        `json:"git_auth_name"`
	StageWriteAccess   bool          `json:"stage_write_access"`
	PreviewWriteAccess bool          `json:"preview_write_access"`
	WebhookTokens      WebhookTokens `json:"webhook_tokens"`
	OrigSourceUrl      string        `json:"orig_source_url"` // the original source url of the app, used for git create in dev mode
}

AppSettings contains the settings for an app. Settings are not version controlled.

type AppSpec

type AppSpec string

type AppStagedUpdateResponse

type AppStagedUpdateResponse struct {
	DryRun              bool            `json:"dry_run"`
	StagedUpdateResults any             `json:"staged_update_results"`
	PromoteResults      []AppPathDomain `json:"promote_results"`
}

type AppToken

type AppToken struct {
	Type  WebhookType `json:"type"`
	Url   string      `json:"url"`
	Token string      `json:"token"`
}

type AppUpdateMessage

type AppUpdateMessage struct {
	MessageType string           `json:"message_type"`
	Payload     AppUpdatePayload `json:"payload"`
}

type AppUpdateMetadataResponse

type AppUpdateMetadataResponse struct {
	DryRun              bool            `json:"dry_run"`
	StagedUpdateResults []AppPathDomain `json:"staged_update_results"`
	PromoteResults      []AppPathDomain `json:"promote_results"`
}

type AppUpdatePayload

type AppUpdatePayload struct {
	AppPathDomains []AppPathDomain `json:"app_path_domains"`
	ServerId       ServerId        `json:"server_id"`
}

type AppUpdateSettingsResponse

type AppUpdateSettingsResponse struct {
	DryRun        bool            `json:"dry_run"`
	UpdateResults []AppPathDomain `json:"update_results"`
}

type AppVersion

type AppVersion struct {
	Active          bool
	AppId           AppId
	Version         int
	PreviousVersion int
	UserId          string
	Metadata        *AppMetadata
	CreateTime      time.Time
}

type AppVersionFilesResponse

type AppVersionFilesResponse struct {
	Files []AppFile `json:"files"`
}

type AppVersionListResponse

type AppVersionListResponse struct {
	Versions []AppVersion `json:"versions"`
}

type AppVersionSwitchResponse

type AppVersionSwitchResponse struct {
	DryRun      bool `json:"dry_run"`
	FromVersion int  `json:"from_version"`
	ToVersion   int  `json:"to_version"`
}

type ApproveResult

type ApproveResult struct {
	Id                  AppId         `json:"id"`
	AppPathDomain       AppPathDomain `json:"app_path_domain"`
	NewLoads            []string      `json:"new_loads"`
	NewPermissions      []Permission  `json:"new_permissions"`
	ApprovedLoads       []string      `json:"approved_loads"`
	ApprovedPermissions []Permission  `json:"approved_permissions"`
	NeedsApproval       bool          `json:"needs_approval"`
}

ApproveResult represents the result of an app approval audit

type Audit

type Audit struct {
	RedactUrl      bool `toml:"redact_url"`
	SkipHttpEvents bool `toml:"skip_http_events"`
}

type AuditEvent

type AuditEvent struct {
	RequestId  string
	AppId      AppId
	CreateTime time.Time
	UserId     string
	EventType  EventType
	Operation  string
	Target     string
	Status     string
	Detail     string
}

type AuthConfig

type AuthConfig struct {
	Key          string   `toml:"key"`           // the client id
	Secret       string   `toml:"secret"`        // the client secret
	OrgUrl       string   `toml:"org_url"`       // the org url, used for Okta
	Domain       string   `toml:"domain"`        // the domain, used for Auth0
	DiscoveryUrl string   `toml:"discovery_url"` // the discovery url, used for OIDC
	HostedDomain string   `toml:"hosted_domain"` // the hosted domain, used for Google
	Scopes       []string `toml:"scopes"`        // oauth scopes
}

AuthConfig is the configuration for the Authentication provider

type AuthorizerFunc added in v0.15.1

type AuthorizerFunc func(ctx context.Context, permissions []string) (bool, error)

type BoolValue

type BoolValue int
const (
	BoolValueUndefined BoolValue = iota
	BoolValueTrue
	BoolValueFalse
)

type CORS

type CORS struct {
	AllowOrigin      string `toml:"allow_origin"`
	AllowMethods     string `toml:"allow_methods"`
	AllowHeaders     string `toml:"allow_headers"`
	AllowCredentials string `toml:"allow_credentials"`
	MaxAge           string `toml:"max_age"`
}

type ClientCertConfig

type ClientCertConfig struct {
	CACertFile string         `toml:"ca_cert_file"`
	RootCAs    *x509.CertPool `toml:"-"`
}

type ClientConfig

type ClientConfig struct {
	GlobalConfig
	Client ClientConfigStruct `toml:"client"`
}

ClientConfig is the configuration for the OpenRun Client

type ClientConfigStruct

type ClientConfigStruct struct {
	SkipCertCheck bool   `toml:"skip_cert_check"`
	AdminPassword string `toml:"admin_password"`
	DefaultFormat string `toml:"default_format"` // the default format for the CLI output
}

ClientConfigStruct is the configuration for the OpenRun Client

type ConfigResponse added in v0.14.10

type ConfigResponse struct {
	DynamicConfig DynamicConfig `json:"dynamic_config"`
}

type ConfigUpdateMessage added in v0.15.0

type ConfigUpdateMessage struct {
	MessageType string              `json:"message_type"`
	Payload     ConfigUpdatePayload `json:"payload"`
}

type ConfigUpdatePayload added in v0.15.0

type ConfigUpdatePayload struct {
	ServerId ServerId `json:"server_id"`
}

type Container

type Container struct {
	// Health check related config
	HealthUrl                  string `toml:"health_url"`
	HealthAttemptsAfterStartup int    `toml:"health_attempts_after_startup"`
	HealthTimeoutSecs          int    `toml:"health_timeout_secs"`

	// Idle shutdown related config
	IdleShutdownSecs    int  `toml:"idle_shutdown_secs"`
	IdleShutdownDevApps bool `toml:"idle_shutdown_dev_apps"`

	// Status check related config
	StatusCheckIntervalSecs int `toml:"status_check_interval_secs"`
	StatusHealthAttempts    int `toml:"status_health_attempts"`
}

type ContextKey

type ContextKey string
const (
	USER_ID         ContextKey = "user_id"
	SHARED          ContextKey = "shared"
	REQUEST_ID      ContextKey = "request_id"
	APP_ID          ContextKey = "app_id"
	APP_PATH_DOMAIN ContextKey = "app_path_domain"
	APP_AUTH        ContextKey = "app_auth"
	GROUPS          ContextKey = "groups"
)

type CreateAppRequest

type CreateAppRequest struct {
	Path             string            `json:"path"`
	SourceUrl        string            `json:"source_url"`
	IsDev            bool              `json:"is_dev"`
	AppAuthn         AppAuthnType      `json:"app_authn"`
	GitBranch        string            `json:"git_branch"`
	GitCommit        string            `json:"git_commit"`
	GitAuthName      string            `json:"git_auth_name"`
	Spec             AppSpec           `json:"spec"`
	ParamValues      map[string]string `json:"param_values"`
	ContainerOptions map[string]string `json:"container_options"`
	ContainerArgs    map[string]string `json:"container_args"`
	ContainerVolumes []string          `json:"container_volumes"`
	AppConfig        map[string]string `json:"appconfig"`
}

CreateAppRequest is the request body for creating an app This gets saved as ApplyInfo when doing declarative app creation

type DryRun

type DryRun bool
const (
	DryRunTrue  DryRun = true
	DryRunFalse DryRun = false
)

type DynamicConfig added in v0.14.10

type DynamicConfig struct {
	VersionId string     `json:"version_id"`
	RBAC      RBACConfig `json:"rbac"`
}

DynamicConfig is the configuration which is settable through API and is persisted to metadata

type EventStatus

type EventStatus string
const (
	EventStatusSuccess EventStatus = "Success"
	EventStatusFailure EventStatus = "Failed"
)

type EventType

type EventType string
const (
	EventTypeSystem EventType = "system"
	EventTypeHTTP   EventType = "http"
	EventTypeAction EventType = "action"
	EventTypeCustom EventType = "custom"
)

type FS

type FS struct {
	FileAccess []string `toml:"file_access"`
}

type GitAuthEntry

type GitAuthEntry struct {
	UserID      string `toml:"user_id"`       // the user id of the user, defaults to "git" https://github.com/src-d/go-git/issues/637
	KeyFilePath string `toml:"key_file_path"` // the path to the private key file
	Password    string `toml:"password"`      // the password for the private key file
}

GitAuth is a github auth config entry

type GlobalConfig

type GlobalConfig struct {
	ConfigFile string `toml:"config_file"`
	AdminUser  string `toml:"admin_user"`
	ServerUri  string `toml:"server_uri"`
}

Config entries shared between client and server

type HttpConfig

type HttpConfig struct {
	Host            string `toml:"host"`
	Port            int    `toml:"port"`
	RedirectToHttps bool   `toml:"redirect_to_https"`
}

HttpConfig is the configuration for the HTTP server

type HttpsConfig

type HttpsConfig struct {
	Host               string `toml:"host"`
	Port               int    `toml:"port"`
	EnableCertLookup   bool   `toml:"enable_cert_lookup"`
	MkcertPath         string `toml:"mkcert_path"`
	ServiceEmail       string `toml:"service_email"`
	UseStaging         bool   `toml:"use_staging"`
	StorageLocation    string `toml:"storage_location"`
	CertLocation       string `toml:"cert_location"`
	DisableClientCerts bool   `toml:"disable_client_certs"`
}

HttpsConfig is the configuration for the HTTPs server

type JSLibrary

type JSLibrary struct {
	LibType           LibraryType
	DirectUrl         string
	PackageName       string
	Version           string
	EsbuildArgs       [10]string // use an array so that the struct can be used as key in the jsCache map
	SanitizedFileName string
}

JSLibrary handles the downloading for JS libraries and esbuild based bundling for ESM libraries

type LibraryType

type LibraryType string
const (
	ESModule LibraryType = "ecmascript_module"
	Library  LibraryType = "library"
)

type LogConfig

type LogConfig struct {
	Level         string `toml:"level"`
	MaxBackups    int    `toml:"max_backups"`
	MaxSizeMB     int    `toml:"max_size_mb"`
	Console       bool   `toml:"console"`
	File          bool   `toml:"file"`
	AccessLogging bool   `toml:"access_logging"`
}

LogConfig is the configuration for the Logger

type Logger

type Logger struct {
	*zerolog.Logger
}

func NewLogger

func NewLogger(config *LogConfig) *Logger

type MetadataConfig

type MetadataConfig struct {
	DBConnection        string `toml:"db_connection"`
	AutoUpgrade         bool   `toml:"auto_upgrade"`
	AuditDBConnection   string `toml:"audit_db_connection"`
	IgnoreHigherVersion bool   `toml:"ignore_higher_version"` // If true, ignore higher version of the metadata schema
	FileCacheConnection string `toml:"file_cache_connection"` // The connection string for the file cache database
}

MetadataConfig is the configuration for the Metadata persistence layer

type NodeConfig

type NodeConfig map[string]any

type NotificationMessage

type NotificationMessage struct {
	MessageType string `json:"message_type"`
}

NotificationMessage is the message sent through the postgres listener

type Permission

type Permission struct {
	Plugin    string   `json:"plugin"`
	Method    string   `json:"method"`
	Arguments []string `json:"arguments"`
	IsRead    *bool    `json:"is_read,omitempty"` // Whether the call is a Read operation or Write operation.
	// nil value means go with the default as set in the plugin code
	Secrets [][]string `json:"secrets"` // The secrets that are allowed to be used in the call.
}

Permission represents a permission granted to an app to run a plugin method with the given arguments

type PluginContext

type PluginContext struct {
	Logger    *Logger
	AppId     AppId
	StoreInfo *starlark_type.StoreInfo
	Config    PluginSettings
	AppConfig AppConfig
	AppPath   string
}

type PluginSettings

type PluginSettings map[string]any

type Proxy

type Proxy struct {
	// Proxy related config
	MaxIdleConns        int  `toml:"max_idle_conns"`
	IdleConnTimeoutSecs int  `toml:"idle_conn_timeout_secs"`
	DisableCompression  bool `toml:"disable_compression"`
}

type RBACConfig added in v0.14.10

type RBACConfig struct {
	Enabled bool                        `json:"enabled"` // whether rbac is enabled
	Groups  map[string][]string         `json:"groups"`  // groups names to user ids. These groups are appended to the groups info from SAML
	Roles   map[string][]RBACPermission `json:"roles"`   // role names to permissions.
	Grants  []RBACGrant                 `json:"grants"`  // grants are used to grant permissions to users/groups for specific apps
}

type RBACGrant added in v0.14.10

type RBACGrant struct {
	Description string   `json:"description"`
	Users       []string `json:"users"`   // users/groups granted by this rule
	Roles       []string `json:"roles"`   // the roles granted by this rule
	Targets     []string `json:"targets"` // the app path globs for which this grant applies
}

type RBACPermission added in v0.14.10

type RBACPermission string
const (
	PermissionList   RBACPermission = "list"   // list apps
	PermissionAccess RBACPermission = "access" // access apps
)

type RequestError

type RequestError struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

RequestError is the error returned by the API

func CreateRequestError

func CreateRequestError(message string, code int) RequestError

func (RequestError) Error

func (r RequestError) Error() string

type SAMLConfig added in v0.15.3

type SAMLConfig struct {
	MetadataURL string `toml:"metadata_url"`
	GroupsAttr  string `toml:"groups_attr"`
	UsePost     bool   `toml:"use_post"`     // whether to use POST binding
	ForceAuthn  bool   `toml:"force_authn"`  // whether to force authn
	SPKeyFile   string `toml:"sp_key_file"`  // the SP key file to use
	SPCertFile  string `toml:"sp_cert_file"` // the SP cert file to use
}

type SecretConfig

type SecretConfig map[string]any

type Security

type Security struct {
	DefaultSecretsProvider string `toml:"default_secrets_provider"`
}

type SecurityConfig

type SecurityConfig struct {
	AdminOverTCP             bool   `toml:"admin_over_tcp"`
	AdminPasswordBcrypt      string `toml:"admin_password_bcrypt"`
	AppDefaultAuthType       string `toml:"app_default_auth_type"`
	SessionMaxAge            int    `toml:"session_max_age"`
	SessionHttpsOnly         bool   `toml:"session_https_only"`
	CallbackUrl              string `toml:"callback_url"`
	DefaultGitAuth           string `toml:"default_git_auth"`
	StageEnableWriteAccess   bool   `toml:"stage_enable_write_access"`
	PreviewEnableWriteAccess bool   `toml:"preview_enable_write_access"`
}

SecurityConfig is the security related configuration

type ServerConfig

type ServerConfig struct {
	GlobalConfig
	Http        HttpConfig                  `toml:"http"`
	Https       HttpsConfig                 `toml:"https"`
	Security    SecurityConfig              `toml:"security"`
	Metadata    MetadataConfig              `toml:"metadata"`
	Log         LogConfig                   `toml:"logging"`
	System      SystemConfig                `toml:"system"`
	GitAuth     map[string]GitAuthEntry     `toml:"git_auth"`
	Plugins     map[string]PluginSettings   `toml:"plugin"`
	Auth        map[string]AuthConfig       `toml:"auth"`
	SAML        map[string]SAMLConfig       `toml:"saml"`
	ClientAuth  map[string]ClientCertConfig `toml:"client_auth"`
	Secret      map[string]SecretConfig     `toml:"secret"`
	ProfileMode string                      `toml:"profile_mode"`
	AppConfig   AppConfig                   `toml:"app_config"`
	NodeConfig  NodeConfig                  `toml:"node_config"`
}

ServerConfig is the configuration for the OpenRun Server

type ServerId

type ServerId string // the id of the server that sent the notification
var CurrentServerId ServerId // initialized in server.go init()

type SpecFiles

type SpecFiles map[string]string

SpecFiles is a map of file names to file data. JSON encoding uses base 64 encoding of file text

func (*SpecFiles) MarshalJSON

func (t *SpecFiles) MarshalJSON() ([]byte, error)

func (*SpecFiles) UnmarshalJSON

func (t *SpecFiles) UnmarshalJSON(data []byte) error

type StringValue

type StringValue string
const (
	StringValueUndefined StringValue = "<OPENRUN_UNDEFINED>"
)

type StyleType

type StyleType string

StyleType is the type of style library used by the app

type SyncCreateResponse

type SyncCreateResponse struct {
	DryRun            bool          `json:"dry_run"`
	Id                string        `json:"id"`
	WebhookUrl        string        `json:"webhook_url"`
	WebhookSecret     string        `json:"webhook_secret"`
	ScheduleFrequency int           `json:"schedule_minutes"`
	SyncJobStatus     SyncJobStatus `json:"sync_job_status"`
}

type SyncDeleteResponse

type SyncDeleteResponse struct {
	DryRun bool   `json:"dry_run"`
	Id     string `json:"id"`
}

type SyncEntry

type SyncEntry struct {
	Id          string        `json:"id"`
	Path        string        `json:"path"`
	IsScheduled bool          `json:"is_scheduled"` // whether this is a scheduled sync
	UserID      string        `json:"user_id"`
	CreateTime  *time.Time    `json:"create_time"`
	Metadata    SyncMetadata  `json:"metadata"`
	Status      SyncJobStatus `json:"status"`
}

type SyncJobStatus

type SyncJobStatus struct {
	State             string           `json:"state"`               // the state of the sync job
	FailureCount      int              `json:"failure_count"`       // the number of times the sync job has failed recently
	LastExecutionTime time.Time        `json:"last_execution_time"` // the last time the sync job was executed
	Error             string           `json:"error"`               // the error message if the sync job failed
	CommitId          string           `json:"commit_id"`           // the commit id of the sync job
	IsApply           bool             `json:"is_apply"`            // whether this is an apply job
	ApplyResponse     AppApplyResponse `json:"app_apply_response"`  // the response of the apply job
}

type SyncListResponse

type SyncListResponse struct {
	Entries []*SyncEntry `json:"entries"`
}

type SyncMetadata

type SyncMetadata struct {
	GitBranch string `json:"git_branch"` // the git branch to sync from
	GitAuth   string `json:"git_auth"`   // the git auth entry to use for the sync

	Promote     bool   `json:"promote"`      // whether this sync does a promote
	Approve     bool   `json:"approve"`      // whether this sync does an approve
	Reload      string `json:"reload"`       // which apps to reload after the sync
	Clobber     bool   `json:"clobber"`      // whether to force update the sync, overwriting non-declarative changes
	ForceReload bool   `json:"force_reload"` // whether to force reload even if there is no new commit

	WebhookUrl        string `json:"webhook_url"`        // for webhook : the url to use
	WebhookSecret     string `json:"webhook_secret"`     // for webhook : the secret to use
	ScheduleFrequency int    `json:"schedule_frequency"` // for scheduled: the frequency of the sync, every N minutes
}

type SystemConfig

type SystemConfig struct {
	TailwindCSSCommand        string   `toml:"tailwindcss_command"`
	FileWatcherDebounceMillis int      `toml:"file_watcher_debounce_millis"`
	WatchIgnorePatterns       []string `toml:"watch_ignore_patterns"`
	NodePath                  string   `toml:"node_path"`
	ContainerCommand          string   `toml:"container_command"`
	DefaultDomain             string   `toml:"default_domain"`
	RootServeListApps         string   `toml:"root_serve_list_apps"`
	EnableCompression         bool     `toml:"enable_compression"`
	HttpEventRetentionDays    int      `toml:"http_event_retention_days"`
	NonHttpEventRetentionDays int      `toml:"non_http_event_retention_days"`
	AllowedEnv                []string `toml:"allowed_env"`            // List of environment variables that are allowed to be used in the node config
	DefaultScheduleMins       int      `toml:"default_schedule_mins"`  // Default schedule time in minutes for scheduled sync
	MaxSyncFailureCount       int      `toml:"max_sync_failure_count"` // Max failure count for sync jobs
	MaxConcurrentBuilds       int      `toml:"max_concurrent_builds"`  // Max concurrent container builds
	MaxBuildWaitSecs          int      `toml:"max_build_wait_secs"`    // Max wait time for a build lock
}

SystemConfig is the system level configuration

type TokenCreateResponse

type TokenCreateResponse struct {
	DryRun bool     `json:"dry_run"`
	Token  AppToken `json:"token"`
}

type TokenDeleteResponse

type TokenDeleteResponse struct {
	DryRun bool `json:"dry_run"`
}

type TokenListResponse

type TokenListResponse struct {
	Tokens []AppToken `json:"tokens"`
}

type Transaction

type Transaction struct {
	*sql.Tx
}

Transaction is a wrapper around sql.Tx

func (*Transaction) IsInitialized

func (t *Transaction) IsInitialized() bool

type UpdateAppMetadataRequest

type UpdateAppMetadataRequest struct {
	Spec          StringValue           `json:"spec"`
	ConfigType    AppMetadataConfigType `json:"config_type"`
	ConfigEntries []string              `json:"config_entries"`
}

UpdateAppMetadataRequest is the request body for updating an app metadata

func CreateUpdateAppMetadataRequest

func CreateUpdateAppMetadataRequest() UpdateAppMetadataRequest

type UpdateAppRequest

type UpdateAppRequest struct {
	AuthnType          StringValue `json:"authn_type"`
	GitAuthName        StringValue `json:"git_auth_name"`
	StageWriteAccess   BoolValue   `json:"stage_write_access"`
	PreviewWriteAccess BoolValue   `json:"preview_write_access"`
	Spec               StringValue `json:"spec"`
}

UpdateAppRequest is the request body for updating an app settings

func CreateUpdateAppRequest

func CreateUpdateAppRequest() UpdateAppRequest

type UserFile

type UserFile struct {
	Id           string
	AppId        string
	FilePath     string
	FileName     string
	MimeType     string
	CreateTime   time.Time
	ExpireAt     time.Time
	CreatedBy    string
	SingleAccess bool
	Visibility   string
	Metadata     map[string]any
}

type VersionMetadata

type VersionMetadata struct {
	Version         int    `json:"version"`
	PreviousVersion int    `json:"previous_version"`
	GitBranch       string `json:"git_branch"`
	GitCommit       string `json:"git_commit"`
	GitMessage      string `json:"git_message"`
	ApplyInfo       []byte `json:"apply_info"`
}

VersionMetadata contains the metadata for an app

type WebhookTokens

type WebhookTokens struct {
	Reload        string `json:"reload"`
	ReloadPromote string `json:"reload_promote"`
	Promote       string `json:"promote"`
}

type WebhookType

type WebhookType string
const (
	WebhookReload        WebhookType = "reload"
	WebhookReloadPromote WebhookType = "reload_promote"
	WebhookPromote       WebhookType = "promote"
)

Jump to

Keyboard shortcuts

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